I would like to remove the action bar's shadow and although there are many similar questions, no of the suggestions works for me. I am using 4.3 Api 18 and would like to work for lower and upper versions. Here is my code:
<style name="MyActionBar" parent="style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="elevation">0dp</item>
<item name="android:actionBarStyle">#style/LineRemover</item>
<item name="android:windowActionBarOverlay">true</item>
</style>
<style name="LineRemover" parent="android:Widget.Holo.ActionBar">
<item name="android:background">#android:color/transparent</item>
</style>
<style name="Base.AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="actionOverflowMenuStyle">#style/OverflowMenu</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
Update:
I decide to use a Toolbar as suggested in the comments and now everything works fine.
try this , for 5.0
<item name="app:elevation">0dp</item>
or try
<item name="windowContentOverlay">#null</item>
<item name="android:windowContentOverlay">#null</item>
Related
I have implemented the floatingsearchview from here. In my activity i am also having the action mode which is enable on long press on list item.On pre-lollipop the action mode overlays the whole searchview but on post lollipop devices it doesn't as seen in the pictures below
The problem is highlighted in below image.
So i want to increase the height of the action mode how can i do it.Well i already tried with styles attribute in style file.My activity current used style is shown below.
<style name="AppTheme.ContexualActionMode">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="colorAccent">#color/accent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorButtonNormal">#color/primary</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:actionModeBackground">#color/actionModeBachgroundColor</item>
</style>
I also tried this but no solution.
<style name="Widget.ActionModeStyle" parent="#style/Widget.AppCompat.ActionMode">
<item name="android:background">#drawable/action_mode_background</item>
<item name="titleTextStyle">#style/TitleTextStyle</item>
<item name="android:height">70dp</item><!--or something-->
</style>
with activity style
<style name="AppTheme.ContexualActionMode">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="colorAccent">#color/accent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorButtonNormal">#color/primary</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:actionModeStyle">#Widget.ActionModeStyle</item>
</style>
can any one help me please.
I guess you found your answer (hopefully) after this long but I was just struggeling with this issue and what worked for me is this:
<style name="AppTheme.ActionMode" parent="#style/Widget.AppCompat.ActionMode">
<item name="background">#color/Blue</item>
<item name="height">104dp</item>
<item name="titleTextStyle">#style/myTitleTextStyle</item>
</style>
and this in your appTheme style
<item name="actionModeStyle">#style/AppTheme.ActionMode</item>
it finally worked for me when i removed the android: prefix from the items
I think i've tried everything on the Internet but nothing seems to work. The icons always stay gray but I want them white. Isn't that purpose of DarkActionBar?
<style name="AppTheme"
parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/one</item>
What it looks like on 4.4 and on 5.0. I want the 5.0 look.
Here is what I have in my project, it works just fine:
<style name="CustomActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="android:windowContentOverlay">#null</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:fastScrollThumbDrawable">#drawable/scroller_style</item>
<item name="colorPrimary">#color/statbar_bg</item>
<item name="colorPrimaryDark">#color/statbar_bg</item>
<item name="colorAccent">#color/statbar_bg</item>
<!-- <item name="windowActionBarOverlay">true</item> -->
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#android:color/white</item>
</style>
<!-- Overflow menu -->
<!-- ActionBar styles -->
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/actionbar_bg</item>
<item name="background">#color/actionbar_bg</item>
<item name="elevation">0dp</item>
<item name="android:titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#FFFFFF</item>
</style>
<style name="MyActionButtonStyle" parent="#android:style/Widget.ActionButton">
<item name="android:minWidth">0dip</item>
<item name="android:paddingLeft">0dip</item>
<item name="android:paddingRight">0dip</item>
</style>
I would also suggest you to check for different style/theme files in different values folders, maybe something is overriding.
#style/Theme.MyAppTheme.ActionBar
<item name="android:popupMenuStyle">#style/popupMenuStyle</item>
<item name="android:actionBarWidgetTheme">#style/Theme.MyTheme.Widget</item>
<item name="android:actionBarItemBackground">#null</item>
<item name="android:listPreferredItemHeightSmall">45dp</item>
<style name="popupMenuStyle" parent="#android:style/Widget.PopupMenu">
<item name="android:popupBackground">#android:color/white</item>
</style>
<style name="Theme.MyTheme.Widget" parent="#android:style/Theme.Holo">
<item name="android:textColor">#0675bc</item>
<item name="android:background">#android:color/white</item>
</style>
I have an activity which is having action bar overflow menu and my custom pop up menu I am using Theme.MyTheme.Widget in the above code it is working fine but the problem is I am using search view in action bar in another activity.Now the problem is if I am using the above code to change the overflow menu background this changes are applying to the search bar also which I don't need
if you API is minimum API level 14 , you can change with this (worked for me).
<style name="Theme.myapp" parent="#style/Theme.Light.DarkActionBar">
<item name="android:actionDropDownStyle">#style/myapp_DropDownNav</item>
<item name="android:actionBarWidgetTheme">#style/myapp.actionBarWidgetTheme</item>
</style>
<style name="myapp.actionBarWidgetTheme" parent="#style/Theme.">
<item name="android:spinnerDropDownItemStyle">#style/myapp.Widget.DropDownItem.Spinner</item>
</style>
<style name="myapp_DropDownNav" parent="#style/Widget.Spinner.DropDown.ActionBar">
<item name="background">#drawable/spinner_background_ab_myapp</item>
<item name="android:background">#drawable/spinner_background_ab_myapp</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_myapp</item>
<item name="android:dropDownSelector">#drawable/selectable_background_myapp</item>
</style>
<style name="myapp.Widget.DropDownItem.Spinner" parent="Widget.DropDownItem.Spinner">
<item name="android:textAppearance">#style/myapp.TextAppearance.Widget.DropDownItem</item>
</style>
<style name="myapp.TextAppearance.Widget.DropDownItem" parent="TextAppearance.Widget.DropDownItem">
<item name="android:textColor">#color/black</item>
</style>
if you are using ActionBarSherlock (minimun API level 9), try this:
<style name="Theme.yourapp" parent="#style/Theme.Sherlock.Light">
<item name="popupMenuStyle">#style/PopupMenu.Style</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Style</item> </style>
<style name="PopupMenu.Style" parent="#style/Widget.Sherlock.Light.ListPopupWindow">
<item name="android:popupBackground">#drawable/your_background</item>
</style>
<style name="DropDownListView.Style" parent="#style/Widget.Sherlock.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/your_background</item>
</style>
Hope it helps you!!
I want to make full translucent action bar like google did, i tried several option, that seems to work on Holo, however they are not "full transparent" in Holo.Light
this is my style so far:
<style name="MyTheme.Translucent" >
<item name="windowActionBarOverlay">true</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="actionBarStyle">#style/MyTheme.ActionBar</item>
<item name="android:actionBarStyle">#style/MyTheme.ActionBar</item>
</style>
<style name="MyTheme.ActionBar" parent="#style/Widget.Sherlock.ActionBar">
<item name="background">#android:color/transparent</item>
<item name="android:background">#android:color/transparent</item>
</style>
and in Oncreate:
getSupportActionBar().setBackgroundDrawable(null);
the result its "almost" what i need
however i see a shade in action bar:
What i want (or something like this)
i found the solution
using
<item name="android:windowContentOverlay">#null</item>
will do the trick to remove the line
please check the link....................
http://cyrilmottier.com/2013/05/24/pushing-the-actionbar-to-the-next-level
**values/themes.xml**
<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>
**values/styles.xml**
<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>
I'm trying to remove the blue underline in the action bar overflow icon. Here is the screenshot:
I don't have tabs but I saw some similar answered questions about action bar tabs underline but nothing worked for me. My Base application theme is Theme.AppCompat.Light. Here are the applied styles:
<style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:activatedBackgroundIndicator">#drawable/nav_drawer_selection</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:windowActionBar">true</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionMenuTextColor">#color/white</item>
<item name="android:actionOverflowButtonStyle">#style/OverFlow</item>
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="actionMenuTextColor">#color/white</item>
<item name="actionOverflowButtonStyle">#style/OverFlow</item>
<item name="android:activatedBackgroundIndicator">#drawable/nav_drawer_selection</item>
</style>
<style name="MyActionBar"
parent="#style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
<item name="android:background">#color/red</item>
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<style name="MyActionBarTitleText"
parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
<style name="OverFlow"
parent="#style/Widget.AppCompat.ActionBar">
<item name="android:src">#drawable/ic_launcher</item>
</style>
Thanks for all the help! If you need more info about the app and code let me know :)
#nejc.m i think it's due to inheritance from the "Widget" parent. Try replacing "Widget.AppCompat.ActionBar" with "Theme.AppCompat.Light.DarkActionBar". Let me know if this works.
I played around and I found out that it's a very easy solution. I added <item name="android:background">#color/red</item> to <style name="OverFlow" parent="#style/Widget.AppCompat.ActionBar">