层图形对象,包含一个Drawable数组,然后按照数组对应的顺序来绘制他们,索引 值最大的Drawable会被绘制在最上层!虽然这些Drawable会有交叉或者重叠的区域,但 他们位于不同的层,所以并不会相互影响,以<layer-list>作为根节点!

相关属性如下

  • drawable:引用的位图资源,如果为空徐璈有一个Drawable类型的子节点
  • left:层相对于容器的左边距
  • right:层相对于容器的右边距
  • top:层相对于容器的上边距
  • bottom:层相对于容器的下边距
  • id:层的id

示例

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="#C2C2C1" />
<corners android:radius="50dp" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle">
<solid android:color="#BCDA73" />
<corners android:radius="50dp" />
</shape>
</clip>
</item>
</layer-list>
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
android:indeterminateOnly="false"
android:maxHeight="10dp"
android:minHeight="5dp"
android:progressDrawable="@drawable/layerlist_one"
android:thumb="@drawable/shape_slider" />

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_bg_ciwei" />
</item>
<item
android:left="25dp"
android:top="25dp">
<bitmap
android:gravity="center"
android:src="@mipmap/ic_bg_ciwei" />
</item>
<item
android:left="50dp"
android:top="50dp">
<bitmap
android:gravity="center"
android:src="@mipmap/ic_bg_ciwei" />
</item>
</layer-list>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/layerlist_two"/>

LayerDrawable的更多相关文章

  1. [原创]android使用代码生成LayerDrawable的方法和注意事项

    为了有更好的UI体验,一般我们会把button.textview等控件的背景设置上阴影.传统的做法是美工提供一张具有阴影效果的nine patch图,然后将其在xml文件中添加到background属 ...

  2. LayerDrawable 资源

    与 StateListDrawable 有点类似,LayerDrawable 也可包含一个 Drawable 数组,因此系统 将会按这些 Drawable 对象的数组顺序来绘制它们,索引最大的 Dra ...

  3. 使用(Drawable)资源——LayerDrawable资源

    与StateListDrawable有点类似,LayerDrawable也可包含一个Drawable数组,因此系统将会按这些Drawable对象的数组顺序来绘制它们,索引最大的Drawable对象将会 ...

  4. Android View加载圆形图片且同时绘制圆形图片的外部边缘边线及边框:LayerDrawable实现

     Android View加载圆形图片且同时绘制圆形图片的外部边缘边线及边框:LayerDrawable实现 LayerDrawable实现的结果和附录文章1,2,3中的layer-list一致. ...

  5. 用LayerDrawable实现两个图片的叠加效果

    Drawable[] layers = new Drawable[2]; layers[0] = new ColorDrawable(primaryColor); layers[1] = new Co ...

  6. Android LayerDrawable资源应用

    1.介绍 (1)常识 (2)特点 2.实例演示 <1>新建drawable文件 app--->src---->main---->res---->drawable , ...

  7. 【腾讯Bugly干货分享】Android动态布局入门及NinePatchChunk解密

    本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/57c7ff5d53bbcffd68c64411 作者:黄进——QQ音乐团队 摆脱 ...

  8. Android中Bitmap,byte[],Drawable相互转化

    一.相关概念 1.Drawable就是一个可画的对象,其可能是一张位图(BitmapDrawable),也可能是一个图形(ShapeDrawable),还有可能是一个图层(LayerDrawable) ...

  9. 疯狂Android讲义 - 学习笔记(五)

    第五章 Android使用统一的Intent对象来封装“启动意图”,不管是启动Activity.Service组件.或者BroadcastReceiver等,提供了一致的编程模型.Intent设计有点 ...

随机推荐

  1. 虚拟机和hadoop

    摘要:VMware虚拟机安装Win10,Win10用虚拟机安装教程 微软发布Win10预览版下载地址后,用WMware虚拟机安装Win10是很好的选择.如何用VMware虚拟机安装Win10,Win1 ...

  2. centos7误删yum源的解决办法 ( -bash: yum: command not found)

    这里以安装阿里的yum源为例: 1.查看自己的centos版本 cat /etc/redhat-release 2.进入阿里云源站地址:http://mirrors.aliyun.com/centos ...

  3. webpack中使用WebpackDevServer实现请求转发

    index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...

  4. Reservoir Sampling 蓄水池采样算法

    https://blog.csdn.net/huagong_adu/article/details/7619665 https://www.jianshu.com/p/63f6cf19923d htt ...

  5. 关闭Entity Framework的导航属性

    public RIS30Entities() : base("name=RIS30Entities") { this.Configuration.ProxyCreationEnab ...

  6. ZZNUOJ-2157: 水滴来袭-【干扰阅读-卡模糊精度1e-8的问题】

    ZZNUOJ-2157: 水滴来袭 那是一个冷雨霏霏的秋天的下午,当罗辑拿着枪威胁三体文明的时候,如果过了三十秒三体人还没有同他展开谈判,罗辑就会扣动扳机即刻结束自己的生命,随后他身上的核弹控制器就会 ...

  7. C# 操作文件夹、文件

    Form namespace FileProperties { public partial class Form1 : Form { private string currentFolderPath ...

  8. qt5 + vs2015自定义控件错误:undefend interface

    控件中编译时因为是把所有的单个控件集成到一个lib中,所以会引用#include<QDesignerCustomWidgetInterface>以及#include<QDesigne ...

  9. I Hate It (HDU 1754)

    Problem 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少.  这让很多学生很反感.  不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师 ...

  10. 线段树QWQ

    一直没碰过线段树,个人认为好长好难,不过这几天做题遇到了裸的线段树的题,TAT. 线段树我理解就是把二叉树的左右节点现在分别看成是两个区间. 那么现在这两个区间的端点怎么存放?怎么能够把这个区间里的数 ...