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 trialRoberto Palomar
3,200 PointsActionBar title text color
I have written the styles for the action bar as described in the video. Still, the title color remains black. Im using android studio and my theme is a child of Theme.AppCompat.Light.
<style name="Theme.Ribbit" parent="@style/Theme.AppCompat.Light"> <item name="actionBarItemBackground">@drawable/selectable_background_ribbit</item> <item name="popupMenuStyle">@style/PopupMenu.Ribbit</item> <item name="dropDownListViewStyle">@style/DropDownListView.Ribbit</item> <item name="actionBarTabStyle">@style/ActionBarTabStyle.Ribbit</item> <item name="actionDropDownStyle">@style/DropDownNav.Ribbit</item> <item name="actionBarStyle">@style/ActionBar.Solid.Ribbit</item> <item name="actionModeBackground">@drawable/cab_background_top_ribbit</item> <item name="actionModeSplitBackground">@drawable/cab_background_bottom_ribbit</item> <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Ribbit</item> <item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_light</item> <item name="android:actionOverflowButtonStyle">@style/Theme.Ribbit.Overflow</item>
</style>
<style name="ActionBar.Solid.Ribbit" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">@drawable/ab_solid_ribbit</item>
<item name="backgroundStacked">@drawable/ab_stacked_solid_ribbit</item>
<item name="backgroundSplit">@drawable/ab_bottom_solid_ribbit</item>
<item name="progressBarStyle">@style/ProgressBar.Ribbit</item>
<item name="android:titleTextStyle">@style/ActionBar.Solid.Ribbit.TitleTextStyle</item>
</style>
<style name="ActionBar.Solid.Ribbit.TitleTextStyle"
parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/text_color</item>
</style>
3 Answers
Harry James
14,780 PointsHey Roberto!
Your ActionBar.Solid.Ribbit.TitleTextStyle style should have the parent of @style/TextAppearance.Holo.Widget.ActionBar.Title
as declared in the Android Documentation here.
This should then update the text color for you.
Hopefully this will fix the problem but if you're still having problems, give me a shout and I'll be happy to help out :)
Carl Lippert
7,359 PointsI have the same problem Roberto. Your suggestion although technically correct Harry is most likely not the solution that will help.
If I am guessing correctly, Roberto changed out all you "Holo's" for "AppCompat" to get the last vid (or before that) to work with Android Studio and some compatibility issues. I did the same. I am just going to chalk this one up to compatibility issues and consider the true content matter understood. Until it crashes. Than maybe I'll fix it ;)
Harry James
14,780 PointsInteresting. I'm using Android Studio and I am using the Holo's completely fine :s
If you want me to look into it then feel free to leave your project files here and I'll get back to you.
Nasir Mahamoud
22,892 PointsIt looks like there are two solutions to this problem using the AppCompat Theme. The first solution I found is to change the action bar text color programmatically (using code) in the Main, Recipients, and View Image Activities. This solution just requires a single line of code in each Activity's onCreate() method, which would look like:
getSupportActionBar().setTitle(Html.fromHtml("<font color='#250054'>Snapper (or Ribbit)</font>"));
The second solution I found is to add an "android:textColorPrimary" tag to your Snapper (or Ribbit) Theme, this solution would look like:
<style name="Theme.Snapper (or Ribbit)" parent="@style/Theme.AppCompat.Light">
//....Skipped all the other tags//
<item name="android:textColorPrimary">@color/text_color</item>
</style>
You can use one or the other. I chose the first solution because the second solution also changes text color in some unwanted places.
Ben Lee
1,777 PointsBen Lee
1,777 Pointsi have the same issue as well, my text does not appear to change in color.
<resources> <!-- <style name="AppTheme" parent="Theme.AppCompat.Light"> </style> -->
like the others, i have changed the theme to AppCompat because i am using android studio. The only issue i can really see are the rendering problems in my drawable files that i have included from the android asset site. "Couldn't resolve resource @drawable/spinner_ab_disabled_snapper <item> tag requires a 'drawable' attribute or child tag defining a drawable"
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:drawable="@drawable/spinner_ab_disabled_snapper" /> <item android:state_pressed="true" android:drawable="@drawable/spinner_ab_pressed_snapper" /> <item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/spinner_ab_focused_snapper" /> <item android:drawable="@drawable/spinner_ab_default_snapper" /> </selector>
but i dont know if these correlate to the issue why my text isnt changing. Thanks
Harry James
14,780 PointsHarry James
14,780 PointsHey Ben Lee!
Would you be willing to share your project files across so that I can take a look for you? I'm not able to solve this just from code as it looks to be something to do with the way it is built that's causing the issue. It is fine to submit all of the code safely but please hide the keys used for Parse:
I will use my own keys for testing.
Note that if you are working on this as a private project then you probably wouldn't want to share your files since they'd be accessible to anyone.
If you are fine with this then please just post a link to the files using a cloud storage service. I'll then download your project and see if I can reproduce and solve the issues you're having.
Here's instructions on how you can export your project:
To export your project, right-click on your project in Android Studio and press Show in Explorer. Then, upload your project directory into a service like Google Drive, SkyDrive or another service of your choice.
Thanks in advance!