I know that I can assign background color to individual views in layout.xml
files. The bg color of a root layout of, say, Activity
is effectively the background color of this activity. But is there a way to set this color globally to the whole application so that all activities and fragments get it automatically? I'm using the Theme.AppCompat
theme.
Or am I not supposed to alter the default grey color at all?
We can set a full-page background color by simply changing the screen height of an HTML body. In Tailwind CSS, we use an alternative of CSS background-color property which is represented as background-color-opacity ( eg: bg-blue-200 ) and it is used to specify the background color of an element.
To set the background color in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <body> tag, with the CSS property background-color. HTML5 do not support the <body> tag bgcolor attribute, so the CSS style is used to add background color.
In styles file in base application theme add below mentioned line for all values folder in
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">@android:color/white</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With