方法一:
在xml中,设置如下
<ImageView
android:id="@+id/xx_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/xx" />java代码中
private ImageView image;
imga = (ImageView) findViewById(R.id.xx_id);image.getBackground().setAlpha(0);
在xml中,设置如下
<ImageView
android:id="@+id/xx_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/xx" />java代码中
private ImageView image;
imga = (ImageView) findViewById(R.id.xx_id);
image.setAlpha(0);
本文介绍了两种在Android中使用Java代码设置ImageView透明度的方法。一种是通过修改ImageView的背景透明度,另一种则是直接调整ImageView本身的透明度。

2649

被折叠的 条评论
为什么被折叠?



