Android find default background color

What you are seeing is actually the background of the activity, not the recyclerview, which is transparent by default. The color did change a view time per Android version.

You can override this in your app theme.

First define the color in values/colors.xml

 <resources>
     <color name="background">#FF0000 </color> 
 </resources> 

Create a themes.xml file in res/values that references that color:

<resources>  
    <style name="MyTheme" parent="@android:style/Theme.Light">       
        <item name="android:windowBackground">@color/background</item>  
    </style> 
</resources> 

and then in your AndroidManifest.xml specify this as the theme for your activities to use.

 <activity
        android:name=".MyActivity"
        android:theme="@style/MyTheme" />

see https://stackoverflow.com/a/10157077/4623782


it's because of theme. specify your theme in res/values/style.xml. or set manually in view definition.

<android.support.v7.widget.RecyclerView
    android:id="@+id/contentView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/some_id"
    android:background="@android:color/white"
 />

it will give you white background on all device


Android default background color

 <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="?android:colorBackground">
 </RelativeLayout

use

 android:background="?android:colorBackground"

Tags:

Android