方法一:

在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 图片设置为透明的更多相关文章

  1. Android webview背景设置为透明无效 拖动时背景闪烁黑色

    Adndroid 2.X的设置 webview是一个使用方便.功能强大的控件,但由于webview的背景颜色默认是白色,在一些场合下会显得很突兀(比如背景是黑色). 此时就想到了要把webview的背 ...

  2. Android ImageView图片透明区域不响应点击事件,不规则图片透明区域响应点击事件

    转载:http://blog.csdn.net/aminfo/article/details/7872681 经常会在项目中用到透明图片,不规则图片,特别是做游戏的时候,需要对图片的透明区域的点击事件 ...

  3. Android ImageView图片自适应 (转)

    网络上下载下来的图片自适应:android:adjustViewBounds="true"(其详细解释在下面)<ImageView     android:id=" ...

  4. [Android] ImageView.ScaleType设置图解 【转载】

    ImageView的Scaletype决定了图片在View上显示时的样子,如进行何种比例的缩放,及显示图片的整体还是部分,等等. 设置的方式包括: 1. 在layout xml中定义android:s ...

  5. [Android] ImageView.ScaleType设置图解

      ImageView的Scaletype决定了图片在View上显示时的样子,如进行何种比例的缩放,及显示图片的整体还是部分,等等. 设置的方式包括: 1. 在layout xml中定义android ...

  6. Android ImageView图片自适应

    网络上下载下来的图片自适应:android:adjustViewBounds="true"(其详细解释在下面) <ImageView     android:id=" ...

  7. Android Imageview 图片居左居右,自定义圆角

    android:scaleType="fitStart"    图片靠左不变形显示, android:scaleType=”fitEnd”  图片靠右显示,不变形. 半透明andr ...

  8. Xamarin.Android ImageView 图片圆角显示

    第一步:在 values 文件夹下新增 Attrs.xml 文件 <?xml version="1.0" encoding="utf-8" ?> & ...

  9. xamarin.Android ImageView 图片圆角(自定义属性、扩展控件)

    新增 /values/Attrs.xml 文件 <?xml version="1.0" encoding="utf-8" ?> <resour ...

随机推荐

  1. ZOJ 刷题记录 小黑屋 (`・д・´)

    P1006:模拟 然而我的同余方程能过样例然而就是WA⊙﹏⊙b [已查明:扩展欧几里得算法出了很隐蔽的问题] int exGcd(int x,int y,int& a,int& b) ...

  2. NOIP2012 借教室 Splay初探

    终于把区间操作的Splay搞明白了…… Splay的大致框架是这样的: [代码中的Zig-Zig和Zig-Zag操作其实是可以优化的,实际只需要3次passDown和3次update] templat ...

  3. 数据库,inner join,left join right join 的区别

    假设有两个表: 学生和课程 student:              class: id    student          id       class    studentId 1      ...

  4. C# 跨线程访问控件

    this.BeginInvoke(new Action(() => { this.StatusProgressBar_ExecutingTaskStatus.Value = (int)value ...

  5. 除法(Division ,UVA 725)-ACM集训

    参考:http://www.cnblogs.com/xiaobaibuhei/p/3301110.html 算法学到很弱,连这么简单个问题都难到我了.但我偏不信这个邪,终于做出来了.不过,是参照别人的 ...

  6. 由Python的super()函数想到的

    python-super *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !im ...

  7. Python中几种数据结构的整理,列表、字典、元组、集合

    列表:shoplist = ['apple', 'mango', 'carrot', 'banana']字典:di = {'a':123,'b':'something'}集合:jihe = {'app ...

  8. 如何用extjs显示一个已经存在的页面

    最近碰到了一个需求: 画面上有个按钮,点击了按钮之后,弹出一个窗体(window),而该窗体(window)上显示的内容是某个系统的内容,如下图所示 查了好长时间的extjs的帮助文档,没有找个现成的 ...

  9. Catharanthus roseus(长春花碱)的生物合成

    标题:Directed Biosynthesis of Alkaloid Analogs in the Medicinal Plant Catharanthus roseus 作者:Elizabeth ...

  10. BZOJ 1200 木梳

    Description Input 第一行为整数L,其中4≤L≤100000,且有50%的数据满足L≤104,表示木板下侧直线段的长.第二行为L个正整数A1,A2,…,AL,其中Ai≤108 Outp ...