I use the following code to set the alpha value of the 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 I'm facing is that setting an alpha value for the entire relative layout will make its children ( TextView and Button ) transparent. However, I want the button and text to be solid colors, not transparent. I tried setting alpha 1 to TextView and Button , but that didn't help. How can i fix this?
source share