Android ImageView 图片设置为透明
方法一:
在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 图片设置为透明的更多相关文章
- Android webview背景设置为透明无效 拖动时背景闪烁黑色
Adndroid 2.X的设置 webview是一个使用方便.功能强大的控件,但由于webview的背景颜色默认是白色,在一些场合下会显得很突兀(比如背景是黑色). 此时就想到了要把webview的背 ...
- Android ImageView图片透明区域不响应点击事件,不规则图片透明区域响应点击事件
转载:http://blog.csdn.net/aminfo/article/details/7872681 经常会在项目中用到透明图片,不规则图片,特别是做游戏的时候,需要对图片的透明区域的点击事件 ...
- Android ImageView图片自适应 (转)
网络上下载下来的图片自适应:android:adjustViewBounds="true"(其详细解释在下面)<ImageView android:id=" ...
- [Android] ImageView.ScaleType设置图解 【转载】
ImageView的Scaletype决定了图片在View上显示时的样子,如进行何种比例的缩放,及显示图片的整体还是部分,等等. 设置的方式包括: 1. 在layout xml中定义android:s ...
- [Android] ImageView.ScaleType设置图解
ImageView的Scaletype决定了图片在View上显示时的样子,如进行何种比例的缩放,及显示图片的整体还是部分,等等. 设置的方式包括: 1. 在layout xml中定义android ...
- Android ImageView图片自适应
网络上下载下来的图片自适应:android:adjustViewBounds="true"(其详细解释在下面) <ImageView android:id=" ...
- Android Imageview 图片居左居右,自定义圆角
android:scaleType="fitStart" 图片靠左不变形显示, android:scaleType=”fitEnd” 图片靠右显示,不变形. 半透明andr ...
- Xamarin.Android ImageView 图片圆角显示
第一步:在 values 文件夹下新增 Attrs.xml 文件 <?xml version="1.0" encoding="utf-8" ?> & ...
- xamarin.Android ImageView 图片圆角(自定义属性、扩展控件)
新增 /values/Attrs.xml 文件 <?xml version="1.0" encoding="utf-8" ?> <resour ...
随机推荐
- SGU 125.Shtirlits
时间限制:0.25s 空间限制:4M 题意: 有N*N的矩阵(n<=3),对所有i,j<=n有G[i][j]<=9,定义f[i][j]为G[i][j]四周大于它的数的个数(F[i][ ...
- 【POJ2912】【并查集】Rochambeau
Description N children are playing Rochambeau (scissors-rock-cloth) game with you. One of them is th ...
- linux之uniq
Linux命令uniq的作用是过滤重复部分显示文件内容,这个命令读取输入文件,并比较相邻的行.在正常情况下,第二个及以后更多个重复行将被删去,行 比较是根据所用字符集的排序序列进行的.该命令加工后的结 ...
- 关于call 与 apply 那些事
1.定义: call : 调用一个对象的一个方法,以另一个对象替换当前的对象. apply : 应用某一对象的一个方法,用另一个对象替换当前的对象. 2.用法: call:call(thisObj, ...
- jquery 实现的一款超简单的图片切换功能
<html><head> <meta http-equiv="Content-Type" content="text/html; chars ...
- css杂项,清除浮动
在写HTML代码的时候,发现在Firefox等符合W3C标准的浏览器中,如果有一个DIV作为外部容器,内部的DIV如果设置了float样式,则外部的容器DIV因为内部没有clear,导致不能被撑开.看 ...
- A*算法深入
A*算法思想容易理解,但要想设计出好的A*算法,则必需要全面深入了解它.在本文章中接下来的内容中,将全面深入探讨该话题.如果对该算法还没有理解的话,则请先查阅上篇文章<A*算法入门>,然后 ...
- for循环,列表和格式化输出
一:for 循环 1. 简单的说如果让你输出1到100之间的整数,用while该怎么实现呢? i= : print(i) i+= 看着是不是只有4行,但是有没有更加简单的办法,不妨我 ...
- Object.defineProperty 规则
- linux主要目录的作用
手动敲一遍.算是加强记忆吧~ /:文件系统的入口,也是最高一级的目录 /bin:最基本的且着急用户和普通用户都可以使用的命令放在此目录下,如:ls.cp等 /boot:存放Linux的内核及引导系统所 ...