Android background color set to gray instead of @android:color/white
Change the "windowBackground" in AppTheme:
In "styles.xml"
<style name="AppTheme" parent="Theme.Holo">
<item name="android:windowBackground">@color/white</item>
</style>
And remove background attribute from your LinearLayout.
Of course make sure your activity using AppTheme as it's theme. (also set @color/white value to "#ffffffff")
ecostanzi
Updated on June 20, 2022Comments
-
ecostanzi almost 2 years
In my app all the views whose background is set to
@background="@android:color/white"
are showed properly on all the devices apart from Samsung Galaxy S3 mini. In this case all these views have a gray background set.In this specific case the background of the LinearLayout containing the checkboxes should be white:
<LinearLayout android:id="@+id/ll_child1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:padding="10dp" android:orientation="vertical" > ... </LinearLayout>
I tried to replace
android:background="@android:color/white"
withandroid:background="#FFFFFF"
, but the only working solution has be the one of creating a white_bg.xml into my drawable directory:<item android:bottom="0px"> <shape android:shape="rectangle" > <solid android:color="@android:color/white" /> </shape> </item>
and changing the background setting to
android:background="@drawable/white_bg"
.Thought this solves my problem, changing all the layouts in my app is quite annoying, especially because this problem seems to affect in few devices only. I wonder if there's a more elegant solution to this.
-
semsamot over 9 yearsMaybe in that phone "windowBackground" is defined as gray in the system-theme and for sure in other phones defined as white. You're welcome!