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 trialZubeyr Aciksari
21,074 PointsNow switch to the button_custom.xml file. In this file we want to change the default button background color to white. U
Please help, don't know what to do here.. Thanks!
"Now switch to the button_custom.xml file. In this file we want to change the default button background color to white. Use @android:color/white as the value."
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/saveButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/save_label"
android:background="@drawable/button_custom"/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@android:color/white"
android:state_pressed="true"/>
<item
android:drawable="@android:color/white"
android:state_focused="true"/>
<item android:drawable="@android:color/white"/>
</selector>
2 Answers
James Simshaw
28,738 PointsHello,
In the button_custom.xml file, you changed all of the colors to white, you only want to do it for the default state, which is the one that does not have any extra modifiers attached to it. If you were to set the other two back to the value at the start of the Challenge, you should be able to pass this Task.
Zubeyr Aciksari
21,074 PointsThanks a lot James, this worked!