android shape个人理解
来源:互联网 发布:php session mysql 编辑:程序博客网 时间:2024/06/01 08:14
shape是利用xml来创造一张图片,用起来效率比直接用图片效率高,个人感觉主要体现在listview的刷新时,利用shape的xml文件作背景比利用bitmap作背景,刷新时明显流畅很多。
1.关于shape的使用,这边文章觉得挺好:http://blog.csdn.net/u012910985/article/details/21553591
2.关于Meterial Design,Android 5.0以上才有,所以了解还不深:http://blog.csdn.net/a396901990/article/details/40153035
最近主要是想实现一个imageView边框的阴影,查阅网上资料发现主要是这几种方法:
1.利用shape的图层,实际上便是利用leyer-list,每一个item表示一个图层,每一个item里面实现一个shape,
底层放置一个阴影色的填充(solid),上层再放置一个白色的填充(solid),利用上层的padding来设置阴影的大小。
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 上图层的矩形 --> <item> <shape android:shape="rectangle" > <solid android:color="#0F000000"/> </shape> </item> <!-- 下图层的矩形 --> <!-- padding来控制边框(阴影)大小 --> <item android:left="2dp" android:top="2dp" android:bottom="2dp" android:right="2dp"> <shape android:shape="rectangle" > <solid android:color="#FFFFFF"/> </shape> </item> </layer-list>
2.利用android 5.0里面的outline和viem的elevation,利用elevation(高度)的不同来设置不同的阴影效果,这个因为没有下载最新sdk,没有试过。
3.希望利用shape里面的gradient(渐变),但发现渐变类型只有线性、扫描和放射性,没有中心渐变,暂时还不知道怎么实现。
0 0
- android shape个人理解
- Android 签名个人理解
- Android Service个人理解
- Android Studio个人理解
- Android Activity个人理解
- Android Binder个人理解
- android事件机制个人理解
- android:shape
- Android Shape
- android shape
- android:shape
- android shape
- android shape
- Android Shape
- android:shape
- Android Shape
- Android Shape
- android shape
- Ubuntu 14.04 安装 tpm emulator 及 tss 软件栈
- 前端代码规范及最佳实践
- Linux内核数据类型及跨平台
- 汽车百科系列之(五): 常见的汽车美容改装误区
- 循环链表
- android shape个人理解
- Fragment not attached to Activity
- Linux USB gadget解析(2)
- VS2010项目的部署与安装
- ios 中UIView bounds 和 frame 属性的区别
- 格式化数字串(增加千分位标示符)
- 解决android webview 中打不开https页面
- 【原创】C语言处理文件数据(1)
- 使用setacl修改注册表的权限