Change line color in bookmarks - ActionBarSherlock

I use ActionBarSherlock to make the application compatible with older devices. The implementation was simple, but now I need to create the standard Holo blue line that you see under the tabs on the red line.

I read several topics ( topic 1 , topic 2 ) here on SO and also an ABS document ( link ), but I can't get it to work.

This is what I still have.

In my AndroidManifest.xml, I added this line to the application tag.

 <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.Sherlock" > <!-- SET THE DEFAULT THEME --> 

Then in res/values/styles.xml i:

 <resources> <style name="AppTheme" parent="android:Theme.Light" /> <style name="Theme.MyTheme" parent="Theme.Sherlock"> <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item> <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item> </style> <style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar"> <item name="android:background">#ff000000</item> <item name="background">#ff000000</item> </style> </resources> 

But when I launch my application, I still see the default blue line color.

What am I doing wrong?


EDIT

Read this if you want to completely create your ActionBarSherlock!

I found here an answer to SO that gave the following link: http://jgilfelt.github.com/android-actionbarstylegenerator

This is a simple generator that generates all the necessary files for a fully customizable ABS! All you have to do is copy the created files to the appropriate folders and install!

Remember to enable the style (you will need to enter the name of the style in the generator) in AndroidManifest. To do this, see the answer below.

+6
source share
2 answers

Few things:

You no longer need <style name="AppTheme" parent="android:Theme.Light" /> unless you want to change it to inherit Theme.Sherlock and use it for your application theme. If you decide to do this, you will have to use Theme.MyTheme for action.

In any case, to fix the problem you want to change

 <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.Sherlock" > 

to

 <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.MyTheme" > 

OR you can apply the theme directly to your actions:

  <activity android:name="com.awesome.package.activity.SomeActivity" android:theme="@style/Theme.MyTheme"/> 

Side note, I recommend this great actionbar tone generator

+8
source

Install the file in the manifest theme as follows:

 <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.MyTheme" > 

It will save all Sherlock themes and add your own styles.

+1
source

Source: https://habr.com/ru/post/922197/


All Articles