Simple question, how do I move everything from bottom actionBar to the actionBar above (right corner). What is the theme called (assuming it has to do with themes). Also how can the bottom actionBar be removed completely!
This is currently my xml-code setting the themes. Theme.ML.ActionBar2 is the theme setting the attribute's for the actionBar:
<resources>
<style name="Theme.ML.Default" parent="#style/Theme.Sherlock">
<item name="android:windowBackground">#drawable/bg_math</item>
<item name="android:windowNoTitle">true</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.ML.ActionBar2" parent="#style/Theme.Sherlock">
<item name="android:windowBackground">#drawable/bg_list_topbar</item>
</style>
<style name="Theme.ML.Tabs" parent="#style/Widget.Sherlock.ActionBar.TabBar">
<item name="windowActionBarOverlay">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:gravity">center</item>
<item name="android:listDivider">#color/transparent</item>
<item name="android:showDividers">none</item>
<item name="android:dividerPadding">0dp</item>
<item name="android:dividerHeight">0dp</item>
<item name="android:dividerVertical">#null</item>
<item name="background">#drawable/tab_bar_background</item>
<item name="android:background">#drawable/tab_bar_background</item>
</style>
<style name="Theme.ML.Text" parent="#style/Widget.Sherlock.ActionBar.TabText">
<item name="android:textColor">#color/text_tab_indicator</item>
<item name="android:textSize">8sp</item>
</style>
</resources>
check this if you have put in your manifest within your activity declaration.
android:uiOptions="splitActionBarWhenNarrow"
Related
I would like to have an ActionBar with the following properties:
Overlay bar, so that the layout's parent view will stretch to full the whole window.
A white title color for the ActionBar.
Transparent background.
I'm targeting API 14+, with AppCompat-v7:22.2.1. So I prepare my styles like this:
<style name="Theme.MyTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/Theme.MyTheme.MyActionBar</item>
<item name="actionBarStyle">#style/Theme.MyTheme.MyActionBar</item>
<item name="colorPrimary">#5af142</item>
<item name="colorPrimaryDark">#06dd09</item>
<item name="colorAccent">#20f304</item>
</style>
<style name="Theme.MyTheme.MyActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:background">#android:color/transparent</item>
<item name="background">#android:color/transparent</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="android:textColor">#android:color/white</item>
</style>
And, in the Manifest, I set Theme.MyTheme as my activity's theme.
1 & 2 are working, 3 is not. It seams that I get a grey-ish background, and I don't know what should I change/add.
Try out below code, which is my styles.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!--<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>-->
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="windowActionBarOverlay">true</item>
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/transparent</item>
<item name="android:titleTextStyle">#style/Theme.YourTheme.Styled.ActionBar.TitleTextStyle</item>
<!-- Support library compatibility -->
<item name="background">#color/transparent</item>
<item name="titleTextStyle">#style/Theme.YourTheme.Styled.ActionBar.TitleTextStyle</item>
</style>
<style name="Theme.YourTheme.Styled.ActionBar.TitleTextStyle" parent="#android:style/Widget.TextView">
<item name="android:textSize">13sp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#android:color/white</item>
<item name="textSize">13sp</item>
<item name="textStyle">bold</item>
<item name="textColor">#android:color/white</item>
</style>
</resources>
I'm trying to customize my sherlock action bar, but nothing that I code in my style.xml is recognized.
In my manifest file:
android:theme="#style/Theme.Sherlock"
My style.xml:
<resources>
<style name="Theme.MyAppTheme" parent="Theme.Sherlock">
<item name="android:actionBarStyle">#style/Theme.MyAppTheme.ActionBar</item>
</style>
<style name="Theme.MyAppTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#222222</item>
<item name="android:height">64dip</item>
<item name="android:titleTextStyle">#style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="Theme.MyAppTheme.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<item name="android:textColor">#fff</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">32sp</item>
</style>
I'm calling my actionbar this way:
public class MainActivity extends SherlockActivity {
com.actionbarsherlock.app.ActionBar actionbar;
...
actionbar = getSupportActionBar();
... }
There is no problem in showing the actionbar, but the same does not show any customization coded in style.xml, can someone help me? Thankful.
It's because you are applying the same original style in the manifest file android:theme="#style/Theme.Sherlock" which doesn't make any difference. You have prepared the custom style with name Theme.MyAppTheme, having parent as Theme.Sherlock. So, you need to declare your customized style(Theme.MyAppTheme) in your manifest file like android:theme="#style/Theme.MyAppTheme". Even you have to include without android prefix attributes too like below as the other answerer also said. Hope this helps. Even you can refer this too.
<style name="Theme.MyAppTheme" parent="Theme.Sherlock.Light">
<item name="android:actionBarStyle">#style/Theme.MyAppTheme.ActionBar</item>
<item name="actionBarStyle">#style/Theme.MyAppTheme.ActionBar</item>
</style>
<style name="Theme.MyAppTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#222222</item>
<item name = "background">#222222</item>
<item name="android:height">64dip</item>
<item name="height">64dip</item>
<item name="android:titleTextStyle">#style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
<item name="titleTextStyle">#style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="Theme.MyAppTheme.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<item name="android:textColor">#fff</item>
<item name="textColor">#fff</item>
<item name="android:textStyle">bold</item>
<item name="textStyle">bold</item>
<item name="android:textSize">32sp</item>
<item name="textSize">32sp</item>
</style>
Use this and you don't need to create your own style
Action Bar Style Generator
This:
<item name="android:actionBarStyle">#style/Theme.MyAppTheme.ActionBar</item>
is for the default ActionBar, notice the 'android:'.
You have to style it like this:
<resources>
<style name="Theme.MyAppTheme" parent="Theme.Sherlock">
<item name="android:actionBarStyle">#style/Theme.MyAppTheme.ActionBar</item>
<item name="actionBarStyle">#style/Theme.MyAppTheme.ActionBar</item>
</style>
<style name="Theme.MyAppTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#222222</item>
<item name="android:height">64dip</item>
<item name="background">#222222</item>
<item name="height">64dip</item>
<item name="android:titleTextStyle">#style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
<item name="titleTextStyle">#style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="Theme.MyAppTheme.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<item name="android:textColor">#fff</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">32sp</item>
<item name="textColor">#fff</item>
<item name="textStyle">bold</item>
<item name="textSize">32sp</item>
</style>
I try to customize actionbar tabs. Look on the picture:
My code:
<style name="ActionBarTabBar" parent="#android:style/Widget.Holo.Light.ActionBar.TabBar">
<item name="android:showDividers">end</item>
<item name="android:divider">#drawable/actionbar_tab_divider</item>
<item name="android:dividerPadding">0dp</item>
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="android:paddingLeft">50dp</item>
<item name="android:paddingRight">0dp</item>
</style>
<style name="ActionBarTab" parent="#android:style/Widget.Holo.ActionBar.TabView">
<item name="android:showDividers">none</item>
<item name="android:measureWithLargestChild">true</item>
<item name="android:gravity">center</item>
</style>
<style name="CustomTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/ActionBar</item>
<item name="android:listSelector">#style/ListView</item>
<item name="android:actionBarTabBarStyle">#style/ActionBarTab</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabBar</item>
</style>
I would like to align the text of tabs to center. When I try to set up showDividers to value middle, divider is not visible. It is visible with values beggining or end.
After more attempts, I've got desired result.
This is my code, that works properly.
<style name="ActionBarTabBar" parent="#android:style/Widget.Holo.Light.ActionBar.TabBar">
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="android:paddingLeft">30dp</item>
<item name="android:paddingRight">30dp</item>
</style>
<style name="ActionBarTab" parent="#android:style/Widget.Holo.Light.ActionBar.TabView">
<item name="android:showDividers">middle</item>
<item name="android:divider">#drawable/actionbar_tab_divider</item>
<item name="android:dividerPadding">0dp</item>
<item name="android:measureWithLargestChild">true</item>
<item name="android:gravity">center</item>
</style>
<style name="CustomTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarTabBarStyle">#style/ActionBarTab</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabBar</item>
</style>
It was needed to specify the style for Widget.Holo.Light.ActionBar.TabView and for this item set up the divider.
Delete styles you don't need to override in order to style your tabs like you described:
<style name="ActionBarTabBar" parent="#android:style/Widget.Holo.Light.ActionBar.TabBar">
<item name="android:divider">#drawable/actionbar_tab_divider</item>
<item name="android:background">#drawable/actionbar_tab_bg</item>
</style>
How can I hide dividers in action bar dropdown menu navigation?
Here is divider which I want to hide:
http://s10.postimage.org/4sjqjxltl/4nk4k.png
I tried following in styles:
<style name="MyActionBar" parent="Widget.Sherlock.Light.ActionBar">
<item name="android:background">#drawable/actionbar_bg_shape</item>
<item name="background">#drawable/actionbar_bg_shape</item>
<item name="android:showDividers">none</item>
<item name="android:divider">#00000000</item>
<item name="android:cacheColorHint">#00000000</item>
<item name="android:dividerHeight">0px</item>
</style>
<style name="MyDropDownNav" parent="Widget.Sherlock.Light.Spinner.DropDown.ActionBar">
<item name="android:textColor">#FFFFFF</item>
<item name="android:background">#drawable/actionbar_bg_shape</item>
<item name="android:popupBackground">#drawable/actionbar_dropdown_bg_shape</item>
<item name="android:dropDownSelector">#drawable/dropdown_nav_selector</item>
<item name="android:dropDownWidth">175dp</item>
<item name="android:dropDownHeight">50dp</item>
<item name="android:showDividers">none</item>
<item name="android:divider">#null</item>
<item name="android:cacheColorHint">#00000000</item>
<item name="android:dividerHeight">0px</item>
<item name="background">#drawable/actionbar_bg_shape</item>
</style>
<style name="Theme.Test.ICS" parent="Theme.Sherlock.Light">
<item name="android:actionDropDownStyle">#style/MyDropDownNav</item>
<item name="actionDropDownStyle">#style/MyDropDownNav</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="actionBarDivider">#drawable/icon</item>
<item name="android:actionBarDivider">#drawable/icon</item>
</style>
I've also tried with changing divider property to color or drawable.
But divider is still present in dropdown menu navigation, no effect at all. Any ideas would be really helpful.
You need to extend the Widget.Sherlock.ListView.DropDown style like this:
<style name="Theme.YourTheme" parent="Theme.Sherlock">
<item name="dropDownListViewStyle">#style/YourThemeDropDownListView</item>
<item name="android:dropDownListViewStyle">#style/YourThemeDropDownListView</item>
</style>
<style name="YourThemeDropDownListView" parent="Widget.Sherlock.ListView.DropDown">
<item name="android:divider">#null</item>
</style>
It's worth to note, that divider Height must be specified to edit divider's color.
<style name="YourThemeDropDownListView" parent="Widget.Sherlock.ListView.DropDown">
<item name="android:divider">#color/White</item
<item name="android:dividerHeight">5dp</item>
</style>
How can I make the icons of the actionbar using ActionBarSherlock closer or further away from each other? Something like android:layout_marginLeftor android:paddingRight?
If I just add the icons on the actionbar they are further away compare to the screenshot of Soundhound below:
my themes.xml:
<style name="Theme.AstraTheme_Purple" parent="#style/Theme.Sherlock">
<item name="actionBarStyle">#style/Widget.AstraTheme_Purple.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.AstraTheme_Purple.ActionBar</item>
<item name="actionButtonStyle">#style/Widget.AstraTheme_Purple.ActionButton</item>
<item name="android:actionButtonStyle">#style/Widget.AstraTheme_Purple.ActionButton</item>
</style>
<style name="Widget.AstraTheme_Purple.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#drawable/purple_bar</item>
<item name="background">#drawable/purple_bar</item>
</style>
<style name="Widget.AstraTheme_Purple.ActionButton" parent="Widget.Sherlock.ActionButton">
<item name="android:minWidth">50dip</item>
</style>
<style name="AppTheme" parent="Theme.Sherlock">
<item name="actionButtonStyle">#style/MyActionButtonStyle</item>
<item name="android:actionButtonStyle">#style/MyActionButtonStyle</item>
</style>
<style name="MyActionButtonStyle" parent="Widget.Sherlock.ActionButton">
<item name="android:minWidth">32dip</item>
<item name="android:padding">0dip</item>
</style>
The default value of android:minWidth for the ActionBar buttons is 56dip.
Don't forget to set #style/AppTheme as the Activity's theme.