Android selector背景以及透明色
selector可以设置图片或layout的点击效果:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@drawable/card_photo_toolbar_p_night" />
<item android:state_pressed="true" android:drawable="@drawable/card_photo_toolbar_p_night" />
<item android:state_selected="true" android:drawable="@drawable/card_photo_toolbar_p_night" />
<item android:drawable="@drawable/card_photo_toolbar_p_night" />
</selector>
如没有state状态标记,如android:state_selected="true",则表明normal状态下的图片值。
另如果直接把<item android:drawable="@drawable/card_photo_toolbar_p_night" />去掉,就想到与normal状态下是一张完全透明的图,等价于
<item android:drawable="@color/transparent" />
transparent = #
另,android提供了一个透明值:
@android:color/transparent,在设置透明背景时可以设置该值。
不过在应用开发时发现,该值并不总是与#00000000相同
具体原因未知。。。。
续:@android:color/transparent的值之所以获取的不对是android4.0系统本身的问题,且是在setttheme之后,重新获取时出错。之前之后的版本都未发生此问题。
解决办法是采用一张透明的.9.png的图片代替。
Android selector背景以及透明色的更多相关文章
- android selector 背景选择器的使用, button (未点击,点击,选中保持状态)效果实现
android selector 背景选择器的使用, button (未点击,点击,选中保持状态)效果实现 首先看到selector的属性: android:state_focus ...
- Android——selector背景选择器的使用详解(二)
在开发应用中,很多情况下要设计listview或button控件的背景,下面总结一下android的selector的用法:1.在drawable中配置Android的selector.将如下的XML ...
- Android selector背景选择器
selector根据不同的选定状态来定义不同的现实效果 常用属性: android:state_selected--------选中 android:state_focused--------获得焦点 ...
- Android RadioButton selector背景
RadioButton selector 背景 <?xml version="1.0" encoding="utf-8"?> <selecto ...
- Android中selector背景选择器
http://blog.csdn.net/forsta/article/details/26148403 http://blog.csdn.net/wswqiang/article/details/6 ...
- 【原创】Android selector选择器无效或无法正常显示的一点研究
想将LinearLayout作为一个按钮,加上一个动态背景,按下的时候,背景变色,这个理所当然应该使用selector背景选择器来做: <LinearLayout android:id=&quo ...
- Android TextView背景颜色与背景图片设置
Android TextView 背景颜色与背景图片设置,android textview 控件,android textview 背景, android textview 图片,android te ...
- Android圆弧背景
代码改变世界 Android圆弧背景 <?xml version="1.0" encoding="utf-8"?><shape xmlns:a ...
- Android添加背景图片和设置app图标
Android添加背景图片和设置app图标 Android 添加背景图片 第一步:找到你要当做背景的图片,并下载下来 第二步:将图片复制到app->res->mipmap文件夹下 第三步: ...
随机推荐
- C#之菜单控件、主窗体打开子窗体、GroupBox控件使用
一.背景 一年前有学习过C#,但没有在项目中去实际做APP,重新捡起来应用到项目中.我同事本来做好一个CANOPEN设备管理的界面,由于近期搜索了别人的开发的界面,我觉得有很多东西要重新安排,以及我已 ...
- Solr 写数据流程
Solr 写数据流程: 1.源字符串首先经过分词器处理,包括:拆分词以及去除stopword. 2.然后经过语言处理,包括大小写转换以及单词转换. 3.将源数据中需要的信息加入到Document中的各 ...
- (转) 如何取消Linux下,vi中显示的^M符号
转自:http://www.cnblogs.com/dkblog/archive/2012/02/03/2337187.html [背景知识] ^M 是ascii中的'\r', 回车符,是16进制的0 ...
- Python 极简教程(十一)字典 dict
字典是以大括号标识,以键值对(key:value)的形式,无序,不可重复,可变的集合类型. 字典具有非常高效的读写效率. >>> d = {} # 创建一个空字典 >>& ...
- PatentTips - Apparatus and method for a generic, extensible and efficient data manager for virtual peripheral component interconnect devices (VPCIDs)
BACKGROUND A single physical platform may be segregated into a plurality of virtual networks. Here, ...
- amazeui学习笔记--css(布局相关2)--等分网格 AVG Grid
amazeui学习笔记--css(布局相关2)--等分网格 AVG Grid 一.总结 1.与grid区别:网格中:am-g + am-u-xx-n 等分网格中只有一个: am-avg-sm-4(在u ...
- amazeui学习笔记--js插件(UI增强2)--按钮交互Button
amazeui学习笔记--js插件(UI增强2)--按钮交互Button 一.总结 1.按钮loading状态: <button type="button" class=&q ...
- eclipse启动tomcat报错
错误信息: 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apach ...
- 实现indexOf
1.先判断Array数组是否含有indexOf方法,如果有直接返回结果:如果没有则利用循环比较得到结果. function indexOf(arr, item) { if(Array.prototyp ...
- LA 3026 - Period KMP
看题传送门:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show ...