Perhaps a useful alternative for a plain color background:
Place LinearLayout on top of ImageView and use LinearLayout as an opacity filter. Below is a small example with a black background:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FF000000" > <RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_height="wrap_content" > <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_stop_big" /> <LinearLayout android:id="@+id/opacityFilter" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#CC000000" android:orientation="vertical" > </LinearLayout> </RelativeLayout>
Change the android: background LinearLayout attribute between # 00000000 (fully transparent) and # FF000000 (completely opaque).
marnaish Feb 06 '12 at 19:24 2012-02-06 19:24
source share