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文件夹下 第三步: ...
随机推荐
- Python数据类型中的字符串类型
1.换行字符:\n print ('I love python.\nAnd you?') 2.转义字符(\):\\ print ('\\\n\\') 3.制表字符(对齐表格的各列):\t print ...
- CISP/CISA 每日一题 五
CISA 每日一题(答) 信息系统审计师要确认系统变更程序中的: 1.变更需求应有授权.优先排序及跟踪机制: 2.日常工作手册中,明确指出紧急变更程序: 3.变更控制程序应同时为用户及项目开发组认可: ...
- 【2017"百度之星"程序设计大赛 - 复赛】Arithmetic of Bomb
[链接]http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=777&pid=1001 [题意] 在这里写 [题解] ...
- C# Aspect-Oriented Programming(AOP) 利用多种模式实现动态代理
什么是AOP(Aspect-Oriented Programming)? AOP允许开发者动态地修改静态的OO模型,构造出一个能够不断增长以满足新增需求的系统,就象现实世界中的对象会在其生命周期中不断 ...
- Hibernate3.5.4---java application的xml和annotation环境搭建(hibernate.cfg.xml配置文件说明,映射文件Student.hbm.xml说明
http://blog.csdn.net/centre10/article/details/6050466 来自于:http://blog.csdn.net/centre10/article/deta ...
- 【CS Round #43 B】Rectangle Partition
[链接]https://csacademy.com/contest/round-43/task/rectangle-partition/ [题意] 水题 [题解] 横着过去,把相邻的边的宽记录下来. ...
- COdeVS——T 1082 线段树练习 3 (分块练习)
http://codevs.cn/problem/1082/ 时间限制: 3 s 空间限制: 128000 KB 题目等级 : 大师 Master 题解 题目描述 Descriptio ...
- 洛谷—— P1062 数列
https://www.luogu.org/problem/show?pid=1062#sub 题目描述 给定一个正整数k(3≤k≤15),把所有k的方幂及所有有限个互不相等的k的方幂之和构成一个递增 ...
- ajax上传进度条
<script type="text/javascript"> function register(){ var frm = document.getElementBy ...
- Windows 64位下 python3.4.3 安装numpy scipy
Numpy: 1.在开始菜单搜索cmd打开 终端 2.在终端输入python -m pip install -U pip 3.到http://www.lfd.uci.edu/~gohlke/pytho ...