1

I want to make a RelativeLayout in side a RelativeLayout semi-transparent.

Its a item for the footer. which is always visible, but I just want to make it 50% transparent of a black color.

I Have tried to use #11000000 Alpha channel, but still dont work.

Thanks

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.app.photoapp.MainActivity" >



    <GridView
            android:id="@+id/gridview"        
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_above="@+id/ly_footer_text"
            android:alwaysDrawnWithCache="true"        
            android:clipChildren="true"
            android:columnWidth="100dp"
            android:gravity="center_horizontal"
            android:horizontalSpacing="2dp"
            android:numColumns="3"
            android:padding="0dp"
            android:scrollingCache="true"
            android:smoothScrollbar="true"
            android:stretchMode="columnWidth"
            android:verticalSpacing="2dp" />


        <!-- Footer  THIS LAYOUT TO MAKE SEMI-TRANSPARENT -->
        <RelativeLayout
            android:id="@+id/ly_footer_text"    
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:background="#11000000"
            android:layout_alignParentBottom="true" >

                <TextView
                    android:id="@+id/tv_footer_left"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="10dp"
                    android:text="@string/footer_sub_text"
                    android:textColor="#999999"
                    android:textSize="12sp" />

                <TextView
                    android:id="@+id/tv_footer_right"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/tv_footer_left"
                    android:layout_alignBottom="@+id/tv_footer_left"
                    android:layout_alignParentRight="true"
                    android:layout_marginRight="10dp"
                    android:text="@string/footer_tnc"
                    android:textColor="#999999"
                    android:textSize="12sp" />

        </RelativeLayout>

</RelativeLayout>
Thiago
  • 12,778
  • 14
  • 93
  • 110

3 Answers3

1

Set the background color to #AARRGGBB where AA is the alpha channel. For example you could use #00000000 for the color or the short method: #ARGB so that would be #0000 Using the shorthand notation the values are each just used twice where #264C would be the same as #226644CC ...http://developer.android.com/reference/android/graphics/Color.html

UMESH0492
  • 1,701
  • 18
  • 31
0

Try this one

android:background="#80000000" 
MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
-1

try to use this code-

  android:background="#50111111"

instead of this-

  android:background="#11000000"
Priyanka
  • 677
  • 5
  • 20
Dakshesh Khatri
  • 639
  • 7
  • 12