Sunday, May 24, 2015

How to change RelativeLayout background color in Android

activity_main.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/rl"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="16dp"
    tools:context=".MainActivity"
    android:background="#ffffa70b"
    >
    <!--
        More options to set RelativeLayout background color

        android:background="@android:color/holo_purple"
        android:background="@android:color/white"
    -->
</RelativeLayout>
More android examples