码迷,mamicode.com
首页 > 移动开发 > 详细

Android ImageView 图片设置为透明

时间:2015-09-28 20:48:58      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

 

方法一:

在xml中,设置如下

<ImageView   
        android:id="@+id/xx_id"   
        android:layout_width="wrap_content"   
        android:layout_height="wrap_content"   
        android:background="@drawable/xx" />   
<ImageView 
        android:id="@+id/xx_id" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/xx" />
 

java代码中

private ImageView image; 
image = (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" />   
<ImageView 
        android:id="@+id/xx_id" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/xx" />
 


java代码中

private ImageView image;   
image = (ImageView) findViewById(R.id.xx_id);   
image.setAlpha(0);
 

 

Android ImageView 图片设置为透明

标签:

原文地址:http://www.cnblogs.com/exmyth/p/4844831.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!