What I'm trying to do is exactly as shown in the image"
I want to remove this divider. I'm using the android built-in action bar. I don't want to use Sherlock Action Bar. I have to use android action bar.
I have tried to add this to my styles but its not working
<style name="MyDropDownNav" parent="android:style/Theme.Holo.Light">
<item name="android:dropDownSelector">#drawable/ic_launcher</item>
<item name="android:divider">#null</item>
</style>
Do you have any suggestions?
You can implement a Translucent Action Bar:
Custom Translucent Android ActionBar
Show ImageView partly behind transparent ActionBar
Define themes:
<resources>
<style name="Theme.TranslucentActionBar" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/Widget.ActionBar</item>
</style>
<style name="Theme.TranslucentActionBar.ActionBar" />
<style name="Theme.TranslucentActionBar.ActionBar.Overlay">
<item name="android:actionBarStyle">#style/Widget.ActionBar.Transparent</item>
<item name="android:windowActionBarOverlay">true</item>
</style>
</resources>
and styles for your Action Bar:
<resources>
<style name="Widget.ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/ab_background</item>
</style>
<style name="Widget.ActionBar.Transparent">
<item name="android:background">#android:color/transparent</item>
</style>
</resources>
Then apply it in your AndroidManifest.xml.
<style name="AppTheme" parent="android:Theme.whatever_theme_you_have">
...
<item name="android:windowContentOverlay">#null</item>
</style>
The divider is contained for actionbar background image.
Try to change actionbar background image. Please refer to below codes.
<style name="AppTheme">
<item name="android:actionBarStyle">#style/ActionBarStyle</item>
</style>
<style name="ActionBarStyle">
<item name="android:background">{SET BACKGROUND FOR YOU}</item>
</style>
Related
I want to change text color and background color of action bar item which is white here. I searched alot but am not able to change this color.
Please check my code which I am using to customise action bar.
final ActionBar actionBar = getActionBar();
ColorDrawable colorDrawable = new ColorDrawable(Color.parseColor (Hexa color));
actionBar . setBackgroundDrawable (colorDrawable);
In your "res/values/themes.xml" file, do something like this:
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/MyPopupMenu</item>
<item name="android:itemTextAppearance">#style/TextAppearance</item>
</style>
<!-- Popup Menu Background Color styles -->
<style name="MyPopupMenu"
parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#color/Your_color_for_background</item>
</style>
<!-- Popup Menu Text Color styles -->
<style name="TextAppearance">
<item name="android:textColor">#color/Your_color_for_text</item>
</style>
And then in your manifest
<application
android:theme="#style/CustomActionBarTheme"
... >
Check this question and some of its answers for more clarification.
You can customize the action bar like below..
<!-- Base application theme. -->
<style name="Theme.AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/Theme.AppTheme.actionBar</item>
<item name="android:actionBarWidgetTheme">#style/Theme.AppTheme.actionBar.widget</item>
<item name="android:textViewStyle">#style/Theme.AppTheme.textView</item>
</style>
<!-- Actionbar things -->
<style name="Theme.AppTheme.actionBar" parent="android:Widget.Holo.Light.ActionBar.Solid">
<item name="android:titleTextStyle">#style/Theme.AppTheme.actionBarTitle</item>
<item name="android:subtitleTextStyle">#style/Theme.AppTheme.actionBarSubtitle</item>
<item name="android:background">#android:color/holo_blue_dark</item>
<item name="android:icon">#drawable/ic_launcher</item>
</style>
<style name="Theme.AppTheme.actionBarTitle" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#android:color/white</item>
</style>
<style name="Theme.AppTheme.actionBarSubtitle" parent="android:TextAppearance.Holo.Widget.ActionBar.Subtitle">
<item name="android:textColor">#android:color/white</item>
</style>
<style name="Theme.AppTheme.actionBar.widget" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/Theme.AppTheme.actionBar.PopupMenu</item>
<item name="android:dropDownListViewStyle">#style/Theme.AppTheme.actionBar.DropDownListView</item>
</style>
<style name="Theme.AppTheme.actionBar.PopupMenu" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#android:color/holo_purple</item>
</style>
<style name="Theme.AppTheme.actionBar.DropDownListView" parent="#android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#android:color/holo_red_light</item>
</style>
<!-- Standard Widgets -->
<style name="Theme.AppTheme.textView" parent="android:Widget.TextView"></style>
Hope this will help you!
how can I change the back ground color of split action bar in android?In my application both split actionbar and actionbar is there.
You can change action bar style through style.xml from values.
working with Android API 11+
<style name="Theme.Suthar" parent="#style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBar.Solid.Suthar</item>
</style>
<style name="ActionBar.Solid.Suthar" parent="#style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/red</item>
<item name="android:backgroundStacked">#color/yellow</item>
<item name="android:backgroundSplit">#color/green</item>
</style>
For AppCompat Theme:
<style name="Theme.Suthar" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">#style/ActionBar.Solid.Suthar</item>
</style>
<style name="ActionBar.Solid.Suthar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#color/red</item>
<item name="backgroundStacked">#color/yellow</item>
<item name="backgroundSplit">#color/green</item>
</style>
I am trying to change the background color of actionbar in my App but this is showing different on my app. Instead of coloring the actionbar the whole activity is color.
I am not sure why this is happening? I just want the main actionbar and settings actionbar colored.
Please check the screenshot.
Main Activity Map:
Preference Settings:
I also have transparent Actionbar with UP Navigation enabled for all my sub activities other than the main activity and preference settings activity.
I am not sure why it is showing like the above:
Here is style.xml (values-v14):
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:background">#FF5050</item>
</style>
<style name="dialogtheme" parent="#android:style/Theme.Holo.Light.DarkActionBar"></style>
<!-- Transparent ActionBar Style -->
<style name="AppTheme.Light.ActionBar.Transparent" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#android:color/transparent</item>
</style>
<!-- Activity Theme with transparent ActionBar -->
<style name="AppTheme.TransparentActionBar.Light" parent="#style/AppBaseTheme">
<item name="android:actionBarStyle">#style/AppTheme.Light.ActionBar.Transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
<item name="android:icon">#android:color/transparent</item>
<item name="android:actionBarTabTextStyle">#style/ActionBarTabTextStyle.Tabtheme</item>
<item name="android:actionBarDivider">#drawable/verticallinefordivder</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.MapsLocation</item>
</style>
<style name="simpledialog" parent="android:Theme.Holo.Light.Dialog">
<item name="android:windowNoTitle">true</item>
</style>
<style name="ActionBarTabTextStyle.Tabtheme" parent="#style/AppBaseTheme">
<item name="android:textSize">18sp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#android:color/black</item>
</style>
<style name="ActionBarTabStyle.MapsLocations" parent="#android:style/Widget.Holo.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator</item>
</style>
<style name="myPreferenceTheme" parent="#style/AppBaseTheme">
<item name="android:textColor">#color/blue</item>
</style>
<style name="Widget.ActionButton" parent="#style/AppBaseTheme">
<item name="android:background">?android:attr/actionBarItemBackground</item>
<item name="android:paddingLeft">12dip</item>
<item name="android:paddingRight">12dip</item>
<item name="android:minWidth">56dip</item>
<item name="android:minHeight">?android:attr/actionBarSize</item>
</style>
</resources>
A little change and you action bar will be red:
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/AppTheme.Light.ActionBar</item>
</style>
<style name="dialogtheme" parent="#android:style/Theme.Holo.Light.DarkActionBar"></style>
<!-- Transparent ActionBar Style -->
<style name="AppTheme.Light.ActionBar" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#FF5050</item>
</style>
I have changed item in AppBaseTheme & AppTheme.Light.ActionBar .
Now you are good to go. let me know if it works however working at my end :P
You can try set custom view in action bar.
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(you_custom_layout);
I know this is not right answer to this question but if you want to edit your ActionBar, you can use this online Android Action Bar Style Generator.
At least you can create a style and check yours to find differences and learn how to edit your ActionBar.
I've set a custom background for my application, and it seems that doing so has caused the ordinarily black background of my ActionBar to become transparent. This makes it difficult to work with the search field I plan on adding to it.
I've tried overriding this with the following:
<style name="app_theme" parent="Theme.AppCompat">
<item name="android:windowBackground">#drawable/app_background</item>
<item name="android:listViewStyle">#style/TransparentListView</item>
<item name="android:expandableListViewStyle">#style/TransparentExpandableListView</item>
<item name="android:actionBarStyle">#style/MyTheme.ActionBarStyle</item>
</style>
<style name="Mytheme.ActionBarStyle" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:windowActionBarOverlay">true</item>
</style>
This does not seem to correct my issue. How can I ensure that my action bar is black like it should be?
You can set action bar color like below:
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#3BB9FF")));
if you want transparent action bar then check this link:
http://cyrilmottier.com/2013/05/24/pushing-the-actionbar-to-the-next-level/
Also you can try xml style:
<style name="AppTheme" parent="android:Theme.Holo">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">#style/action_bar_theme</item>
<item name="android:actionMenuTextColor">#fff</item>
</style>
<style name="action_bar_theme" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#b3000000</item>
<item name="android:titleTextStyle">#style/action_bar_text</item>
</style>
Hope this will help....
I am trying to change the drop down background of the sherlock action bar as well as its text color. Here's what I have tried:
<style name="DropDown" parent="Widget.Sherlock.Spinner.DropDown.ActionBar">
<item name="android:popupBackground">#EDEDED</item>
</style>
<style name="TextAppearance" parent="TextAppearance.Sherlock.Widget.TextView.SpinnerItem">
<item name="android:textColor">#A9A9A9</item>
</style>
<style name="SpinnerItemStyle" parent="Widget.Sherlock.TextView.SpinnerItem">
<item name="android:textAppearance">#style/TextAppearance</item>
</style>
<style name="MyTheme" parent="#style/devcheckStyle">
<item name="android:actionDropDownStyle">#style/DropDown</item>
<item name="actionDropDownStyle">#style/DropDown</item>
<item name="spinnerItemStyle">#style/SpinnerItemStyle</item>
<item name="android:spinnerItemStyle">#style/SpinnerItemStyle</item>
</style>
The main theme being MyTheme, with the following code I am getting the desirable background color, but I am getting nowhere with the text's color inside the drop down navigation. Can someone please help.
Put that code
<item name="android:textColor">#ffffffff</item>
into your MyTheme code should be like:
<style name="MyTheme" parent="#style/devcheckStyle">
<item name="android:actionDropDownStyle">#style/DropDown</item>
<item name="actionDropDownStyle">#style/DropDown</item>
<item name="spinnerItemStyle">#style/SpinnerItemStyle</item>
<item name="android:spinnerItemStyle">#style/SpinnerItemStyle</item>
</style>