Monday, May 25, 2015

How to create a transparent background RelativeLayout 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="@android:color/transparent"
    >
    <!--
        Background color with different level transparency
            android:background="#5CFF4A2D"
            android:background="#c0f873ff"
            android:background="#15FF3A45"
    -->
</RelativeLayout>
More android examples