I am using the following code to set the alpha value of a layout:
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="54dp"
android:alpha="0.85"
android:background="@color/label_background"
android:gravity="center_vertical"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true" >
<Button
android:id="@+id/accountButton"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="12dp"
android:background="@drawable/settings" />
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/account"
android:scaleType="fitXY"
android:src="@android:drawable/divider_horizontal_dim_dark" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:text="@string/pick_up"
android:textColor="@color/white"
android:textSize="22dp"
android:textStyle="bold"
custom:customFont="Roboto-Regular.ttf" />
</RelativeLayout>
The problem that i am facing is that setting an alpha value to the whole relative layout will make its children(the TextView
and the Button
) transparent also. However, I want the button and the text to be solid colors and not transparent. I tried setting an alpha
value of 1 to the TextView
and the Button
but it didn't help. How can I correct this?