I had a problem with toolbar and status bar. I change the app styles to AppCompat. My styles are:
for values/styles.xml
<style name="AppTheme" parent="Theme.AppCompat">
<item name="colorPrimary">#color/color_primario_500</item>
<item name="colorPrimaryDark">#color/color_primario_500</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
for values-v21/styles.xml:
<style name="AppTheme" parent="AppTheme.BaseGps">
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">#android:transition/move</item>
<item name="android:windowSharedElementExitTransition">#android:transition/move</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
My problem is that half the toolbar appears behind status bar. In the next image you can see what happens.
Any ideas? Thanks in advance!!
The solution is apply the item
<item name="android:windowTranslucentStatus">false</item>
in the styles.
I don't like these answers. Just because with Material design a Navigation Drawer should overlap the toolbar and have a translucent status bar so long as the API level supports it.
If you want the toolbar to fit properly and have a translucent status bar then you just need these items in your style.
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">true</item>
Related
I want to make my status bar and navigation bar transparent (not translucent).
<style name="FullScreenDialog" parent="#android:style/Theme.Dialog">
<item name="android:windowBackground">#null</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowFrame">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:navigationBarColor">#android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:background">#null</item>
</style>
I have tried a number of different combinations but none seem to work. This current setup gives me a black status bar background. I'm sure I'm missing something simple. I have also tried using:
android:fitsSystemWindows="true"
On my layouts.
Thank you for the help.
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
Hi this is my style attributes, "myAppTheme" is my application's theme and "MyActionModeStyle" is my actionmode's style.
<style name="myAppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#color/primaryColor</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="actionModeStyle">#style/MyActionModeStyle</item>
</style>
<style name="MyActionModeStyle" parent="Widget.AppCompat.ActionMode">
<item name="actionModeBackground">#drawable/red_bg</item>
<item name="android:actionModeBackground">#drawable/red_bg</item>
<item name="backgroundSplit">#drawable/red_bg</item>
<item name="android:backgroundSplit">#drawable/red_bg</item>
<item name="android:titleTextStyle">#style/ActionModeText</item>
<item name="titleTextStyle">#style/ActionModeText</item>
</style>
I want to change the background of action ode to red color but unfortunately nothing happends, still action mode is in default white color.. How can i change its color.. Any idea ?
Oh ! At last i had got a solution.I had changed my action mode custom theme into activities' theme.Now its works.. This is my custom theme for activity
android:theme="#style/customActionModeTheme"
and this is my custom style
<style name="customActionModeTheme" parent="myAppTheme">
<item name="android:actionModeBackground">#color/primaryColor</item>
<item name="actionModeBackground">#color/primaryColor</item>
</style>
I have a problem implementing the translucent status and navigation bar in Android 4.4...
So, when I enable the translucent status und nav bar, even after declaring FitsSystemWindows and ClipToPadding, even the ActionBar goes behind the Status bar.
Here's my theme, maybe there is an error there:
<style name="Theme.Start" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/ActionBar.Transparent.Start</item>
<item name="android:colorBackground">#android:color/white</item>
<item name="android:windowBackground">#android:color/white</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:clipToPadding">false</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
This can occur when your actionbar contain only a title.
The following work for me
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:fitsSystemWindows">false</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
Be sure to init your actionbar Home button after your setContentView()
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
Does it solve your problem?
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>