Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialElvis Chitsungo
1,817 PointsI am lost,can someone help
i need help guys
<resources xmlns:android="http://schemas.android.com/apk/res/android">
</resources>
<!--Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.NoActionBar">
<!--Customize your theme here.-->
<item name="android:colorAccent">@android:color/darker_gray</item>
</style>
</style name="TweetButton">
<item name="android:layout_height">64dp</item>
<item name="android:layout_width">64dp</item>
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
</style>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/sendButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/send_button_label" />
</RelativeLayout>
10 Answers
Calin Bogdan
14,921 PointsCheers!
You have to reference the style you just created to the Button element, like so:
<Button
android:id="@+id/sendButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/send_button_label"
style="@style/TweetButton"/>
Good luck!
Elvis Chitsungo
1,817 PointsWhat about on the styles section
Calin Bogdan
14,921 PointsStyles section is just fine.
Elvis Chitsungo
1,817 PointsI have tried again but in still getting
Bummer! Don't forget to add the 'style' element inside the 'resources' element.
Calin Bogdan
14,921 PointsOh, I've missed that, sorry.
The <style> tags have to be inside <resources>. They are currently outside of it. That should fix all your issues.
Elvis Chitsungo
1,817 Pointsso how can I make style be inside resource
Calin Bogdan
14,921 PointsMove the <style> tags between <resources> and </resources>, like so:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.NoActionBar">
<!--Customize your theme here.-->
<item name="android:colorAccent">@android:color/darker_gray</item>
</style>
<style name="TweetButton">
<item name="android:layout_height">64dp</item>
<item name="android:layout_width">64dp</item>
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
</style>
</resources>
Elvis Chitsungo
1,817 PointsI think the first 1 have been solved, im now getting this new problem
Bummer! Make sure you set the 'name' attribute to 'TweetButton'
Calin Bogdan
14,921 PointsCopy the code from my last answer again, I edited the mistake.
Elvis Chitsungo
1,817 Pointsim now having network challenge. Calin Bogdan thanks. I will continue tomorrow.
Elvis Chitsungo
1,817 PointsIm now having this error:-
Bummer! Make sure you set the 'name' attribute to 'TweetButton'
Calin Bogdan
14,921 PointsOops! That's probably because I was using ':' instead of '=' on the layout xml file.
Make sure to change the following in the activity_main.xml file, at the Button element.
style:"@style/TweetButton" -> style="@style/TweetButton"
Elvis Chitsungo
1,817 PointsIt is giving the same error after correcting (style:"@style/TweetButton") to this (style="@style/TweetButton").
Calin Bogdan
14,921 PointsAre you sure you corrected it in styles.xml too?
</style name="TweetButton">
<item name="android:layout_height">64dp</item>
<item name="android:layout_width">64dp</item>
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
</style>
--->
<style name="TweetButton">
<item name="android:layout_height">64dp</item>
<item name="android:layout_width">64dp</item>
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
</style>
Elvis Chitsungo
1,817 PointsYes i have corrected it in styles.xml. im still getting the below message
Bummer! Make sure you set the 'name' attribute to 'TweetButton'.
Jennifer Nordell
Treehouse TeacherHi there, Elvis Chitsungo! I'm following up to make sure you got your issue resolved. I hope you did! If not, can I please see your current code for the challenge? Thanks