1. No, no, how to see the Imageview.setalpha (INT) in the "Related XML Properties" section is missing another method is View.setalpha (floating)/android:alpha instead. However, only because API level 11 is the latter.
2. It is easier than other reactions. There is an XML value alpha
that requires double value. The invisible Android:alpha="0.0"
Android:alpha="0.5"
perspective Android:alpha="1.0"
is all visible and that's how it works.
3. I don't know about XML, but you can do this in the following way by code.
ImageView myImageView = new ImageView(this);myImageView.setAlpha(xxx);
0 < range <=255,0 is transparent and 255 is opaque.
4. Perhaps a useful alternative to the background of a pure color: Put the linearlayout in ImageView's linearlayout as an opaque filter. In a small example below, there is a black background:
<linearlayout xmlns:android= "codego.net 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 Android: Background properties between LinearLayout #00000000 (fully transparent) and #ff000000 (completely opaque).
5. There is now an alternative to XML:
<ImageView android:id="@+id/example" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/example" android:alpha="0.7" />
It is: android:alpha= "0.7" with values from 0 (transparent) to 1 (opaque).
6. Alpha can be set together with the following hexadecimal format argb# or #aarrggbb. See
7. Use this form to get an older version of Android.
ImageView myImageView;myImageView = (ImageView) findViewById(R.id.img);AlphaAnimation alpha = new AlphaAnimation(0.5F, 0.5F);alpha.setDuration(0); alpha.setFillAfter(true); myImageView.startAnimation(alpha);
Android and set alpha (image) Transparency