How to make a status bar transparent in a dialog fragment? - android

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.

Related

How to change the height of the contextual action mode on lollipop and above device?

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

Android action mode view background color is not able to change

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>

Toolbar behind status bar

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>

Fully Transparent Action bar on Holo Light Theme

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>

Styling of AlertDialog buttons

In my application I use holoeverywhere. I would like to change the appearance of AlertDialog and I got stuck on buttons below alert dialog. I took a look how things were done in holoeverywhere and I tried to modify that.
Here is backtracking of my reasoning:
In theme there are atributes which define alertDialogTheme and some other stuff. We will come back later to selectableItemBackground also.
<style name="Holo.Base.Theme" parent="Theme.AppCompat">
...
<item name="alertDialogTheme">#style/Holo.Theme.Dialog.Alert</item>
...
<item name="buttonBarButtonStyle">?borderlessButtonStyle</item>
...
<item name="selectableItemBackground">#drawable/item_background_holo_dark</item> *
...
</sytle>
So i figure alertDialogStyle is my target which is further defined in styles:
<style name="Holo.Base.Theme.Dialog" parent="Holo.Theme">
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:windowAnimationStyle">#style/Holo.Animation.Dialog</item>
<item name="android:windowBackground">#drawable/dialog_full_holo_dark</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowFrame">#null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowTitleStyle">#style/Holo.DialogWindowTitle</item>
<item name="borderlessButtonStyle">#style/Holo.Button.Borderless.Small</item>
<item name="buttonBarStyle">#style/Holo.ButtonBar.AlertDialog</item>
<item name="listPreferredItemPaddingLeft">16dip</item>
<item name="listPreferredItemPaddingRight">16dip</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="windowAnimationStyle">#style/Holo.Animation.Dialog</item>
<item name="windowContentOverlay">#null</item>
<item name="windowMinWidthMajor">#dimen/dialog_min_width_major</item>
<item name="windowMinWidthMinor">#dimen/dialog_min_width_minor</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Holo.Theme.Dialog" parent="Holo.Base.Theme.Dialog" >
</style>
<style name="Holo.Theme.Dialog.Alert" parent="Holo.Theme.Dialog">
<item name="alertDialogStyle">#style/Holo.AlertDialog</item>
<item name="alertDialogTitleDividerColor">#color/holo_blue_light</item>
<item name="android:windowBackground">#android:color/transparent</item>
</style>
<style name="Holo.Button.Borderless" parent="Holo.Button">
<item name="android:background">?selectableItemBackground</item>
<item name="android:paddingLeft">4dip</item>
<item name="android:paddingRight">4dip</item>
</style>
So Holo.Theme.Dialog.Alert is inherited from Holo:base.Theme.Dialog which has an atribute for borderlessButtonStyle, which I guess defines the buttons of alert dialog.
Style Holo.Button.Borderless referes the atribute selectableItemBackground for its background. Atribute is set in application theme itself. So, my reasoning is if I inherit from theme Holo.theme and set selectableBackground atribut my change should reflect in customized alert dialog buttons and everything else where this background is used.
<style name="ThemeCustom" parent="#style/Holo.Theme>
…
<item name="selectableItemBackground">#drawable/custom_item_background </item>
…
</style>
But this does not work. No change is visible in alert dialog buttons. Is there something wrong with my reasoning?

Categories

Resources