Android layer-list的属性和使用具体解释
Android layer-list的属性和使用具体解释。layer-list是用来多个图层堆叠显示的,借这个特性能够做一些特别的效果(比方:阴影、以下的效果等),也能够投机取巧。
1.代码片
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <!--近期的项目中须要用到多个图层堆叠到一块儿,就研
究了一下android中的layer-list。android中的layer-list
就是用来多个图层堆叠显示的。 -->
<item>
<shape > <!-- 第一层的颜色为蓝色 -->
<solid android:color="@color/blue"/>
</shape>
</item> <!-- 第二层的颜色。也就是最上面的一层,由于第二层相对于
View的底部上移两个dp所以第一层会露出一个dp的黑色所以
给人一种仅仅有底部边框的假象 -->
<item android:bottom="2dip">
<shape>
<solid android:color="@color/white"/>
</shape>
</item> </layer-list>
2.布局代码和效果图 (一定要注意在使用RadioGroup的时候要记的写RadioButton的id,否则不能切换)
<RadioGroup
android:id="@+id/rg"
android:layout_below="@id/bt2"
android:layout_margin="10dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"> <RadioButton
android:id="@+id/rb0"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:button="@null"
android:text="分类"
android:checked="true"
android:gravity="center"
android:textColor="@color/black"
android:background="@drawable/ch_bg"
android:layout_marginTop="2dip"
android:paddingBottom="4dip"/> <RadioButton
android:id="@+id/rb1"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:text="分类"
android:button="@null"
android:gravity="center"
android:textColor="@color/black"
android:background="@drawable/ch_bg"
android:layout_marginTop="2dip"
android:paddingBottom="4dip"/> </RadioGroup>
选择器
<? xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_checked="true" android:drawable="@drawable/bg_li"></item>
<item android:state_checked="false" android:drawable="@color/white"></item>
</selector>
效果图
3.代码片
<?xml version="1.0dip" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item>
<bitmap android:src="@drawable/ic_launcher"
android:gravity="center"/>
</item>
<item android:left="10dip" android:top="10dip">
<bitmap android:src="@drawable/ic_launcher"
android:gravity="center"/>
</item>
<item android:left="20dip" android:top="20dip">
<bitmap android:src="@drawable/ic_launcher"
android:gravity="center"/>
</item>
<item android:left="30dip" android:top="30dip">
<bitmap android:src="@drawable/ic_launcher"
android:gravity="center"/>
</item> </layer-list>
效果图
4.代码片
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/ic_launcher"></item>
<item android:left="10dip" android:top="10dip" android:drawable="@drawable/ic_launcher"></item>
<item android:left="20dip" android:top="20dip" android:drawable="@drawable/ic_launcher"></item>
<item android:left="30dip" android:top="30dip" android:drawable="@drawable/ic_launcher"></item> </layer-list>
5.知识库连接:
http://blog.csdn.net/brokge/article/details/9713041
http://www.aitinan.com/4004.html
http://www.cnblogs.com/tsoorr/p/3407935.html
http://www.cnblogs.com/ithouge/articles/ithouge-android-layer-list-shape-corners.html
http://www.linuxidc.com/Linux/2012-05/59827.htm
Android layer-list的属性和使用具体解释的更多相关文章
- android中xml tools属性详解
第一部分 安卓开发中,在写布局代码的时候,ide可以看到布局的预览效果. 但是有些效果则必须在运行之后才能看见,比如这种情况:TextView在xml中没有设置任何字符,而是在activity中设置了 ...
- 如果需要将UIView的4个角全部都为圆角,做法相当简单,只需设置其Layer的cornerRadius属性即可
如果需要将UIView的4个角全部都为圆角,做法相当简单,只需设置其Layer的cornerRadius属性即可(项目需要使用QuartzCore框架).而若要指定某几个角(小于4)为圆角而别的不变时 ...
- Android读取自定义View属性
Android读取自定义View属性 attrs.xml : <?xml version="1.0" encoding="utf-8"?> < ...
- android中xmlns:tools属性详解
今天读到一篇总结的非常棒的文章,写的逻辑很清晰也很实用,很少见到如此棒的文章了.就原文转发过来,我把格式给整理了一下,分享给园子里的各位朋友!好久没写博客了,就为2015年的11月留份纪念吧.希望对你 ...
- Mono for Android布局控件属性小结
1. layout_weight 用于给一个线性布局中的诸多视图的重要度赋值. 所有的视图都有一个layout_weight值,默认为零,意思是需要显示 多大的视图就占据多大的屏幕空 间.若赋一个高于 ...
- 【Android】使用persist属性来调用脚本文件
Android系统中有许多属性,属性由两个部分组成:name & value,可以使用这些属性来记录系统设置或进程之间的信息交换.Android系统在启动过程时会按序从以下几个文件中加载系统属 ...
- Android开发之EditText属性详解
1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...
- android控件的属性
android控件的属性 本节描述android空间的位置,内容等相关属性及属性的含义 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 ( ...
- 【转】 Android开发之EditText属性详解
原文网址:http://blog.csdn.net/qq435757399/article/details/7947862 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: ...
- Android中的windowSoftInputMode属性详解
这篇文章主要介绍了Android中的windowSoftInputMode属性详解,本文对windowSoftInputMode的9个属性做了详细总结,需要的朋友可以参考下 在前面的一篇文章中 ...
随机推荐
- vue -- config index.js 配置文件详解
此文章介绍vue-cli脚手架config目录下index.js配置文件 此配置文件是用来定义开发环境和生产环境中所需要的参数 关于注释 当涉及到较复杂的解释我将通过标识的方式(如(1))将解释写到单 ...
- HTML5入门:HTML5的文档声明和基本代码
HTML5的文档声明: HTML5的文档声明,不同于HTML4.0和XHTML,它精简了许多代码,只保留<!DOCTYPE html>开头,必须位于HTML5文档的第一行,它可以用来告诉浏 ...
- 闲的无聊写了个很(wu)有(liao)意(dao)思(bao)的程序
下午机房断网了 闲的无聊,写了个小游戏 忘了sleep在哪个库里了.. 自带变色效果哦 #include<iostream> #include<cstdio> #include ...
- 英语 用on还是/at/还是in
in prep. 1. [表示地点.场所.位置等]在…里面:在…内部:在…上:例句: in the room 在房间里 2. [表示时间]在…期间:在(一段时间)以内:过…之久:例句: in su ...
- java(异常体系及权限修饰符)
java异常体系 异常的体系: 异常体系: --------| Throwable 所有错误或者异常的父类 --------------| Error(错误) --------------| Exce ...
- linux系统下的/proc目录介绍
1. /proc目录 Linux 内核提供了一种通过 /proc 文件系统,在运行时访问内核内部数据结构.改变内核设置的机制.proc文件系统是一个伪文件系统,它只存在内存当中,而不占用外存空间.它以 ...
- split---将文件分割成多个小文件
split命令可以将一个大文件分割成很多个小文件,有时需要将文件分割成更小的片段,比如为提高可读性,生成日志等. 选项 -b:值为每一输出档案的大小,单位为 byte. -C:每一输出档中,单行的最大 ...
- 【Codeforces Round #456 (Div. 2) C】Perun, Ult!
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] set1 < pair < int,int > > set1;记录关键点->某个人怪物永远打不死了,第 ...
- 安装 VNC 和 XRDP
安装 VNC 和 XRDPapt-get install vnc4server tightvncserver xrdp fluxbox xtermcat >vncstop.sh << ...
- NOI2005维修数列(splay)
题目描述: Description 请写一个程序,要求维护一个数列,支持以下 6 种操作: 请注意,格式栏 中的下划线‘ _ ’表示实际输入文件中的空格 Input 输入的第1 行包含两个数N 和M( ...