Where to add custom sherlock bar custom theme for actionbar? - android

i would like to customize sherlock action bar (background color, font color, etc..).
I found some useful links here on stack overflow, but i dont know, where to put my new theme xml config file and how link them from AndroidManifest?
Thanks for any help.

You have to add in style like this
<style name="Theme.MyApp.Default" parent="#style/Theme.Sherlock.Light">
<item name="actionBarStyle">#style/MyApp.SherlockActionBarStyle</item>
<item name="android:actionBarStyle">#style/MyApp.kActionBarStyle</item>
</style>
<style name="MyApp.ActionBarStyle" parent="#style/Widget.Sherlock.ActionBar">
<item name="android:background">#ff000000</item>
<item name="background">#ff000000</item>
<item name="android:textSize">#dimen/textsize</item>
<item name="textSize">#dimen/textsize</item>
<item name="android:textColor">#color/grey</item>
<item name="textColor">#color/grey</item>
</style>

Related

Light theme action bar have weird artefact since AppCompat v21

Since I upgraded appcompat to v21 (now on v22.2.1), when using light theme, the action bar have a very odd artefact as seen on the screenshot below. When using dark theme, no problems whatsoever!
I tried to change the style of the action bar using this and it works, however there's no more title! All other ActionBar styles are showing the artefact.
<item name="actionBarStyle">#style/Widget.AppCompat.Light.ActionBar.TabBar</item>
Here are my dark/light themes definitions:
<style name="AT_Theme" parent="#style/Theme.AppCompat">
<item name="android:windowBackground">#android:color/black</item>
<item name="android:colorBackground">#android:color/black</item>
<item name="android:textColorPrimary">#ffffffff</item>
<item name="switchStyle">#style/switch_dark</item>
<item name="android:textAppearanceButton">#style/CustomTheme.ButtonTextAppearance</item>
<item name="android:listChoiceIndicatorSingle">#drawable/abc_btn_radio_material_light</item>
<item name="android:listChoiceIndicatorMultiple">#drawable/abc_btn_check_material_light</item>
</style>
<style name="AT_Theme_Light" parent="#style/Theme.AppCompat.Light">
<item name="android:windowBackground">#android:color/white</item>
<item name="android:colorBackground">#android:color/white</item>
<item name="android:textColorPrimary">#ff000000</item>
<item name="switchStyle">#style/switch_light</item>
<item name="android:textAppearanceButton">#style/CustomTheme.ButtonTextAppearance</item>
<item name="android:listChoiceIndicatorSingle">#drawable/abc_btn_radio_material</item>
<item name="android:listChoiceIndicatorMultiple">#drawable/abc_btn_check_material</item>
</style>
I tried tweaking/overriding a lot of things to no avail. Also search for a color definition or drawable that would do that, no result there either.
Please help me get rid of that artefact:
Turns out the solution was so simple:
1) Change actionBarStyle in app's custom theme, both light/dark works with this:
<item name="actionBarStyle">#style/Widget.AppCompat.Light.ActionBar.Toolbar</item>
2) Enable title in code:
ActionBar ab = aba.getSupportActionBar();
if (ab != null)
ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE,ActionBar.DISPLAY_SHOW_TITLE);

Overflow menu row customization

I am wanting to customise the rows of the overflow menu in the action bar. I found a great blog post explaining how to go about doing this, which seem simple enough. The link is below.
http://scriptedpapers.com/2014/08/12/android-action-bar-overflow-menu-customization/
I am specifically wanting to change the background colour of the overflow menu rows so the theme that I am using looks like the following:
<resources>
<!--the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/CustomActionBar</item>
<item name="android:homeAsUpIndicator">#drawable/upcaret</item>
<item name="android:actionOverflowButtonStyle">#style/CustomOverflowButton</item>
<item name="android:popupMenuStyle">#style/PopupMenu</item>
</style>
<!--ActionBar style -->
<style name="CustomActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/customBlue</item>
</style>
<style name="CustomOverflowButton" parent="#android:style/Widget.Holo.Light.ActionButton.Overflow">
<item name="android:src">#drawable/overflowbutton</item>
</style>
<style name="PopupMenu" parent="android:Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">#color/customBlue</item>
</style>
Applying this theme to the application, the background colour of the overflow menu remains the same colour as the default for Holo.Light.DarkActionBar, despite setting a custom popupMenuStyle.
For my project, the minSdkVersion is 15 and targetSdkVersion is 19.
Does anyone have any ideas?
Thanks.
Try specifying a 9-patch drawable instead of a color.
Go here and choose the color that you want your rows to be by selecting a color from the "Popup color" drop-down.
The only file you need from the zip is menu_dropdown_panel.9.png.
Make sure to place this file in your various drawable-xxxx folders.
Then use it like this:
<style name="PopupMenu" parent="android:Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel</item>
</style>
If it still doesn't work, add this to the above:
Add this line to your main theme (CustomActionBarTheme):
<item name="android:actionBarWidgetTheme">#style/PopupWrapper</item>
Then add this:
<style name="PopupWrapper" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/PopupMenu</item>
</style>

Lollipop Theme issue

I am using sherlock action bar in my project, I have used Theme.Sherlock.Light.DarkActionBar
<style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="android:homeAsUpIndicator">#drawable/transparent</item>
<item name="homeAsUpIndicator">#drawable/transparent</item>
<item name="actionBarStyle">#style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.MyTheme.ActionBar</item>
<item name="android:titleTextStyle">#style/Widget.MyTheme.TitleTextStyle</item>
<item name="android:textAllCaps">false</item>
</style>
Problem :
I am getting light color menu with lollipop:
pre lollipop image :
Lollipop image :
can some one guide me, how can I get slimier menu color on both .
You can create a style which extends from actionbar sherlock to change color of you actionbar with other properties.
<style name="Theme.MyTheme" parent="Theme.Sherlock.ForceOverflow">
<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>
<item name="android:textColor">#CC3232</item>
</style>
For TextColor only
<style name="YOURTHEME.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<item name="android:textColor">#color/yourColor</item>
<item name="textColor">#color/yourColor</item>
</style>
Last resort Solution
<item name="android:textColorPrimary">#color/yourColor</item>
You should create a new styles.xml in a separate values-21 folder. There, you can define a specific theme/style that suits your needs for Lollipop devices only.
You should be using the ActionBar or ToolBar provided by app-compat library, instead of ActionBarSherlock.
ABS uses replacement Holo themes for older versions, which I guess hasn't been updated in a while.

Android - How to change text color of action tab menu?

I'm trying to tweak my app with some custom colors but I cannot change the text color of the action bar.
This is how it is currently showing:
If you look close you might see letters in the white tab bar. I'm trying to change this color to black without changing anything else of the action bar.
This is how my styles.xml looks like:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBar</item>
</style>
<style name="ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/default_green</item>
<item name="android:backgroundStacked">#color/stacked_white</item>
<item name="android:backgroundSplit">#color/sa_green</item>
</style>
Any help is appreciated.
You can make your custom theme here:
http://jgilfelt.github.io/android-actionbarstylegenerator/
Which includes all tabs and other component.
Try this ...
This should be in the theme
<item name="actionBarTabTextStyle">#style/tabtextcolor</item>
<item name="android:actionBarTabTextStyle">#style/tabtextcolor</item>
This should be where you define the tab text color.
<style name="tabtextcolor" parent="#style/Widget.Sherlock.ActionBar.TabText">
<item name="android:textColor">#android:color/white</item>
</style>

ActionbarSherlock overflow menu styling issue

I am following the examples on the ActionbarSherlock website
<style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarStyle">#style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.Styled.ActionBar</item>
</style>
<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/bg_striped</item>
<item name="android:background">#drawable/bg_striped</item>
<item name="backgroundSplit">#drawable/bg_striped_split</item>
<item name="android:backgroundSplit">#drawable/bg_striped_split</item>
</style>
however with this setup I am not able to change the style for the overflow menu.
the properties "android:popupMenuStyle" and "android:dropDownListViewStyle" is completely ignored.
If i change the themes parent to "Theme.Sherlock.Light" it works. Is this intentional? If not how would you style the overflow menu dropdown and at the same time keep the themes parent "Theme.Sherlock.Light.DarkActionBar" as per the example on the Sherlock website.
thanks
You should check out this actionbar style generator. It works great and should help resolve your issue: http://jgilfelt.github.com/android-actionbarstylegenerator/

Categories

Resources