Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set global application background color?

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?

like image 881
Violet Giraffe Avatar asked Sep 16 '16 12:09

Violet Giraffe


People also ask

How do I change the background color on a whole page in CSS?

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.

How do you change the background color of an entire page in HTML?

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.


1 Answers

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>
like image 114
Preetika Kaur Avatar answered Nov 15 '22 03:11

Preetika Kaur