Please give me solution to hide the status bar of translucant screen, i have tries by setting Theme.NoTitleBar.Fullscreen but it works for normal activity, but its not working for the screen witch is translucant.Please give me the hint to solve the problem.
Thanks
That's how I usually do this by overriding one of standard themes.
<style name="ExampleTheme" parent="android:Theme.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
You then can apply the theme to your activity. I hope that helps.
Above solution is not work for me.
I used "#android:style/Theme.Holo.NoActionBar.Fullscreen" as parent theme.
<style name="ExampleTheme" parent="#android:style/Theme.Holo.NoActionBar.Fullscreen">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
https://developer.android.com/training/system-ui/status
Related
I have three activities on my App. MainActivity's layout is a DrawerLayout with fitsSystemWindows="true". The other two activities' root element is a CoordinatorLayout with the same properties. I've defined android:launchMode="singleTop" for all activities in the manifest.
All activities use the same theme AppTheme, which has the following attributes:
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:navigationBarColor">#color/colorPrimaryDark</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowBackground">#color/background</item>
<item name="android:colorBackground">#color/background</item>
</style>
This works for the MainActivity, but does not for the other two, where the statusbar is black (instead of transparent as it should be). This was not the case with the previous version (v7:27.0.2) of the support library. Anyone have any idea what might be wrong here? Thanks in advance!
I have the same problem, with a slight twist: my status bar is completely white rather than black.
I had "solved" this problem by sticking with support-v27.0.2 when I first tried to upgraded to support-v27.1.0. However, support-v27.1.1 is now released and the problem persists, so this is not likely to be a bug by google, and therefore needs a proper fix.
The solution that works for me is exactly as described by Thomas Vos in the comments below the OP. I thought it would be worth giving further detail here, as this appears to be the best solution.
In "styles.xml (v21)" you will likely have a style called "AppTheme.NoActionBar" which will look something like this:
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
</style>
You obviously may have additional items if you have edited the style, but whatever you have, just add the following to the bottom of the list between the style tags.
The status bar should then be back to normal.
<item name="statusBarBackground">?attr/colorPrimaryDark</item>
I "solved" this by downgrading to support-v27.0.2. This is unfortunately one of those (not-so-rare) cases where Google changes something and doesn't document it anywhere.
I would like to make an application that uses the same theme as the 'complete action using' app on Android 5. Does it even exist or do I have to write that on my own?
I finally found out, how to achieve this. The theme is: Theme.Material.Light.NoActionBar, then you need to add a fragment. Edit the theme so the activity is transparent:
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
And finally set the background of the fragment to white.
android:background="#color/primary"
I'm using a theme that inherits from "android:Theme.Material.Light" and am unable to find a way to hide the action bar from the xml style customizations. When using "Theme.AppCompat.Light" I was able to do it with something like this
<style name="MyTheme" parent="Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
How can I achieve a similar result with the material theme? I know you can hide it programmatically but not only is it inconvenient because you can't actually see the real layout on Android studio without having to run the app every time, but also, the action bar still appears for a second when you run the app, before getActionBar().hide() is run and it looks really unprofessional.
SOLUTION:
<style name="MyTheme" parent="android:Theme.Material.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
</style>
<style name="MyTheme" parent="android:Theme.Material.Light.NoActionBar">
<style name="NoActionBar" parent="_AppTheme">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowNoTitle">true</item>
</style>
and then apply the style to the Activity in your manifest as follow :
<activity
android:name=".youractivity"
android:theme="#style/NoActionBar" >
then if your java class extends the ActionBarActvity fix it to extend the Activity and also you had to change all the other Acivity to extend the Activity Class not the ActionBarActivity :)
i hope this will help you :)
Well I'm a bit late, but if someone is interested here is my solution.
I needed to inherit from a theme which has the action bar visible, so not using theme.NoActionBar.
Looking into the system theme here's what I found:
<style name="MainTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
I want to remove the divider under the ActionBar, already search here for it and tried the different things, but nothing worked for me.
Here are the styles, I hope you can help me.
<style name="ListeningThemeTranslucentActionBar" parent="#style/ListeningTheme">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">#style/ListeningTranslucentActionBar</item>
<item name="android:actionBarDivider">#null</item>
</style>
<style name="ListeningTranslucentActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#android:color/transparent</item>
</style>
You probably didn't apply your styles in the Manifest. You will have to add
android:theme="#style/ListeningThemeTranslucentActionBar"
in your Manifest.xml. (If there is already a android:theme parameter just change it to your theme.)
Also this link might be helpfull.
So I'm trying to style the tabs of my Actionbar, which I've implemented using the ActionBarSherlock library. This is my code:
<style name="Theme.AndroidDevelopers" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="actionBarTabStyle">#style/CustomActionBarStyle</item>
<item name="android:actionBarTabStyle">#style/CustomActionBarStyle</item>
<style name="CustomActionBarStyle" parent="Widget.Sherlock.Light.ActionBar.TabBar">
<item name="android:background">#drawable/actionbar_tab_bg</item>
</style>
At the second and third line, if I change actionBarTabStyle to actionBarStyle, my actionbar itself is changed to my wanted style (not very well, ofcourse), so the connections do work. However, trying to change the actionbar tabs (below it), has still no success.
I hope somebody can help me.
With Regards,
The following should work
<style name="Theme.app" parent="#style/Theme.Sherlock.Light">
<item name="android:actionBarTabBarStyle">#style/Theme.app.tabbar.style</item>
<item name="actionBarTabBarStyle">#style/Widget.app.ActionBar.TabBar</item>
</style>
<style name="Theme.app.tabbar.style" parent="#style/Theme.Sherlock.Light">
<item name="android:background">#FF0000</item>
<item name="background">#FF0000</item>
</style>
<style name="Widget.app.ActionBar.TabBar" parent="Widget.Sherlock.ActionBar.TabBar">
<item name="android:background">#FF0000</item>
<item name="background">#FF0000</item>
</style>
This makes the tabBar red.
You need to set two times the actionBarTabBarStyle. This is because of Android > 3.0 and Android <3.0
In your CustomActionBarStyle you need to have
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="background">#drawable/actionbar_tab_bg</item>
Hope this helps :)
So I had some difficulties with the styling because of a certain way I found to add the tabs by code in the first place. Thank you for the responses, they all work.