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 trial

Android Build an Interactive Story App (Retired) Finishing the User Interface Customizing a Button

Edwin Rozario
Edwin Rozario
2,922 Points

<Button android:textColor="#ffffff" /> not working for challenge

I am at the challenge https://teamtreehouse.com/library/build-an-interactive-story-app/finishing-the-user-interface/customizing-a-button

and

android:textColor="#ffffff" dosent seem to be working.

Error! Make sure you are using the right color code for white.

activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/thrustButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="@string/thrust_label"
        android:background="#ffaa0000"
        android:textColor="#ffffff"/>

</RelativeLayout>

3 Answers

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Hi Edwin,

It looks like you forgot the "alpha" value when setting your text color. You should have 8 "f's"

Edwin Rozario
Edwin Rozario
2,922 Points

Thanks John

 But even 3 f's seems to work in my local.
Jon Kussmann
Jon Kussmann
Courses Plus Student 7,254 Points

Yes, 3/6 values for a hex color will work in practice.

The 6 "digit" hex color does not specify an alpha value so will (I believe) default to completely opaque, or ff.

The 3 "digit" hex color is a shorthand way of specifying a 6 "digit" hex color if each pair of values is the same. For example: #AABBCC can be put as #ABC.

However, if you want the specific color #A1B23C, you have to use all 6 "digits" and cannot shorten it.

The exercise wanted you to explicitly set an alpha value (said so in the question), which is why it was needed for a correct answer.