Button或者ImageButton的背景设为透明或者半透明

半透明<Button android:background="#e0000000" ... /> 
透明<Button android:background="#00000000" ... />

颜色和不透明度 (alpha) 值以十六进制表示法表示。任何一种颜色的值范围都是 0 到 255(00 到 ff)。对于 alpha,00 表示完全透明,ff 表示完全不透明。表达式顺序是“aabbggrr”,其中“aa=alpha”(00 到 ff);“bb=blue”(00 到 ff);“gg=green”(00 到 ff);“rr=red”(00 到 ff)。例如,如果您希望对某叠加层应用不透明度为 50% 的蓝色,则应指定以下值:7fff0000

设置背景图片透明度(超简单)

Java代码

  1. View v = findViewById(R.id.content);//找到你要设透明背景的layout 的id
  2. v.getBackground().setAlpha(100);//0~255透明度值

Button或者ImageButton的背景设为透明或者半透明的更多相关文章

  1. Button 或 ImageButton 背景设为 透明 或半透明 (转)

    半透明<Button android:background="#e0000000" ... /> 透明<Button android:background=&qu ...

  2. android 设置Button或者ImageButton的背景透明 半透明 透明

    Button或者ImageButton的背景设为透明或者半透明 半透明<Button android:background="#e0000000" ... />  透明 ...

  3. ImageButton去边框&Button或者ImageButton的背景透明

    在ImageButton中载入图片后,很多人会觉得有图片周围的白边会影响到美观,其实解决这个问题有两种方法 一种方法是将ImageButton的背景改为所需要的图片.如:android:backgro ...

  4. Android 如何把一个 RelativeLayout或ImageView背景设为透明

    在项目中,需要把RelativeLayout 和  ImageView背景设置为透明,怎么实现呢?这里主要通过代码,请参阅以下关键代码: public ImageView imgDetail; pri ...

  5. Android 设置按钮背景透明与半透明_图片背景透明

    Button或者ImageButton的背景设为透明或者半透明 半透明<Button android:background="#e0000000" ... />  透明 ...

  6. Android中Button、ImageButton、ImageView背景设置区别

    Button与ImageButton实际两者无关,Button继承自TextView,不支持src;ImageButton继承自ImageView.同一张图片在不设置大小,默认显示时,使用Button ...

  7. Button、ImageButton及ImageView详解

    Button.ImageButton及ImageView详解 在应用程序开发过程中,很多时候需要将View的background或者src属性设置为图片,即美观又支持点击等操作.常见的有Button. ...

  8. Android控件——Button与ImageButton

    1.简单介绍

  9. Android监听Button和ImageButton控件的点击事件

    一.onClick事件 Button和ImageButton都有一个onClick事件,通过自身的.setOnClickListener(OnClickListener)方法添加点击事件 所有的控件都 ...

随机推荐

  1. Windows7 SP1 64bit配置IIS7.5和ASP.NET4

    一.安装前的环境 1. Windows7 SP1 64bit: 2. 在安装IIS7.5之前,安装了Visual Studio 2010或.NET Framework4: 二.安装IIS7.5 1.  ...

  2. vue-cl发布vue

    npm run dev是开发环境, npm run build是生产环境, 在开发环境完成代码和测试, 之后用生产环境生成代码, npm run build的时候, 一开始就会提示Built file ...

  3. 【转】Notepad++中Windows,Unix,Mac三种格式之间的转换

    原文网址:http://www.crifan.com/files/doc/docbook/rec_soft_npp/release/htmls/npp_func_windows_unix_mac.ht ...

  4. vue项目修改favicon

    首先你的在你的static文件中添加favicon.icon 然后通过以下方式进行修改 1)方式一:修改index.html文件 <link rel="shortcut icon&qu ...

  5. Cacti不出图

    http://os.51cto.com/art/201404/434915.htmhttp://os.51cto.com/art/201109/289306.htmhttp://freeloda.bl ...

  6. api proxy设置 后端服务器代理

    location ^~ /api/{ ssi on; ssi_silent_errors off; proxy_redirect off; proxy_set_header Host $host; p ...

  7. [html] charset

    UTF-8是全球通用的,GB2312一般是简体中文,GBK在他的范围上扩展了繁体中文,适合香港台湾. 页面透明效果 CSS: opacity:0.1;filter: Alpha(Opacity=10, ...

  8. AWT,Swing,RCP 开发

    http://www.blogjava.net/youxia/category/17374.html

  9. [Python] String strip() Method

    Description The method strip() returns a copy of the string in which all chars have been stripped fr ...

  10. [Octave] optimset()

    Create options struct for optimization functions. optimset('parameter', value, ...); %设置所有参数及其值,未设置的 ...