Notification bar overlays an app.
Here is the AppTheme:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="colorPrimary">#color/ColorPrimary</item>
<item name="colorPrimaryDark">#color/ColorPrimaryDark</item>
</style>
And the manifest:
android:theme="#style/AppTheme"
How can I fix it?
Acording to the docs:
By enabling translucent system bars, your layout will fill the area behind the system bars.
So change it value to false.
Related
Please tell me, I have an application that uses a webView in full screen. As of android 10, the navigation bar started to overlap my webView:
By putting <item name="android:windowTranslucentNavigation">true</item>, the navigation bar stopped overlapping the webView, but I would like to make it black and but not transparent. How can I implement this? Perhaps I can do something differently so that the navigation bar does not overlap the webView? I'm new to this.
My style.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">#drawable/background_splashscreen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:navigationBarColor">#color/black</item>
</style>
Thanks in advance.
I've started my project with a "Navigation Drawer Activity" in Android Studio 2.2.3. Then changed the parent of AppTheme to Theme.AppCompat.Light and the primary and secondary color to a white color. However, when I open my main activity I noticed that the hamburger icon and the overflow menu icon are slightly lighter than the pitch black title in the appbar, see left screenshot. However, what's weird is that when I go to a second blank activity the up arrow and any other icon I place in the navigation bar are as black as the title. Does anyone know where this styling is coming from so I can change it? My code is shown below the screenshot.
My main goal is to change the color of the hamburger and overflow menu icon.
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Light">
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
</style>
</resources>
I've found a fix. Editing the color of the hamburger icon can be done by adding
<style name="AppTheme" parent="Theme.AppCompat.Light">
(...)
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#color/materialBlackPrimary</item>
</style>
and editing the color of the overflow menu icon can be done by adding
<style name="AppTheme" parent="Theme.AppCompat.Light">
(...)
<item name="actionOverflowButtonStyle">#style/OverflowButtonStyle</item>
</style>
<style name="OverflowButtonStyle" parent="Widget.AppCompat.ActionButton.Overflow">
<item name="android:tint">#color/materialBlackPrimary</item>
</style>
i have a dialog activity and want to remove the action bar from it , and anther dialog activity but just want to change the color of its action bar >>
i tried to change the theme and style but nothing change also.
<style name ="Dialog" parent="Theme.AppCompat.Dialog">
<item name="windowActionBar">false</item>
</style>
and the other style is
<style name ="coloredDialog" parent="Theme.AppCompat.Dialog">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="windowActionBar">false</item>
</style>
also i have tried to use
getSupportActionBar().hide()
but their some is error then and the app is closed suddenly
I've changed style for my action bar like that:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:actionOverflowButtonStyle">#style/MyAppTheme</item>
</style>
<style name="MyAppTheme" parent="AppTheme">
<item name="android:src">#drawable/menu_white</item>
<item name="android:layout_gravity">right</item>
</style>
And icon of menu now situated on the center of action bar. How to change it to be from the right?
It was my bad.
I forgot to resize the image and it caused that kind of problem. Now I've resized image ans it looks pretty well.
So in the app I am making, I have both a dark and light theme. The light theme works fine, but the alert dialogs I have still show the background the same as the light theme. Since it is dark, the text changes to light and the user can't see anything. Is there a certain attribute I need to change?
Here is the styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#E53935</item>
<item name="colorPrimaryDark">#C62828</item>
<item name="android:navigationBarColor">#E53935</item>
<item name="android:colorAccent">#1565C0</item>
<item name="android:colorForeground">#color/foreground_material_light</item>
<item name="android:colorBackground">#color/background_material_light</item>
<!-- Other attributes -->
</style>
<style name="Dark" parent="#style/AppTheme" >
<item name="android:colorForeground">#color/foreground_material_dark</item>
<item name="android:colorPrimary">#color/primary_material_dark</item>
<item name="android:colorPrimaryDark">#color/primary_dark_material_dark</item>
<item name="android:colorAccent">#color/accent_material_dark</item>
<item name="android:navigationBarColor">#color/primary_material_dark</item>
<item name="android:colorBackground">#color/background_material_dark</item>
<item name="android:textColorPrimary">#android:color/primary_text_dark</item>
<item name="android:textColorPrimaryInverse">#android:color/primary_text_light</item>
<item name="android:textColorSecondary">#android:color/secondary_text_dark</item>
<item name="android:textColorSecondaryInverse">#android:color/secondary_text_light</item>
<item name="android:textColorTertiary">#android:color/tertiary_text_dark</item>
</style>
Here is what it shows up as:
Solved: You need to create your own xml like this:
<item name="alertDialogTheme">#style/DarkAlertDialog</item>
With this being your custom dialog:
<style name="DarkAlertDialog" parent="Theme.AppCompat.Dialog">
<item name="background">#color/background_material_dark</item>
</style>
Use the parent AppCompat and then use colorPrimary and colorAccent properties (without an Android prefix) to theme things.
Right now the styles are coming from a dialog subtheme and not being affected by these style definitions.