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 Styles and Themes in Android Themes and Compatibility Creating a Theme

This theme is actually a prank for a coworker. We are going to set the color of all text to be transparent. Add an

This theme is actually a prank for a coworker. We are going to set the color of all text to be transparent. Add an item for "android:textColor" and set the value to "@android:color/transparent"

can someone help. am confused.

styles.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
 <style name ="CustomTheme"
        parent="Theme.AppCompat.DayNight.DarkActionBar">
   <item name="android:textColor" >"@android:color/transparent">



</resources>

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Sean,

You're almost there, but there are a few things in error here:

  1. The value shouldn't be surrounded by quotes.
  2. You are missing the closing </item> tag.
  3. You are missing the closing </style> tag.

Once those are fixed up, the task will pass. :)

Keep Coding! :dizzy:

i still cannot get it. i have made this adjustments: Challenge Task 2 of 2

This theme is actually a prank for a coworker. We are going to set the color of all text to be transparent. Add an item for "android:textColor" and set the value to "@android:color/transparent". Bummer! Don't forget to add the 'item' element inside your 'style element. Restart Get Help Recheck work styles.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android">
  <style name ="CustomTheme"
         parent ="Theme.AppCompat.DayNight.DarkActionBar"
         <item name ="android:textColor">@android:color/transparent"</style>
</resources>
Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Still missing the closing </item> and now you're missing the closing > for the style declaration. And you still have a quotation mark in the color value!

Below is the corrected code for you to review. Remember XML is very picky... one little missed tag or angle brackets will break your code.

<resources xmlns:android="http://schemas.android.com/apk/res/android">
  <style name ="CustomTheme" parent ="Theme.AppCompat.DayNight.DarkActionBar">
    <item name ="android:textColor">@android:color/transparent</item>
</style>
</resources>

thanks Jason, you saved my day.