1,作用:
可以在xml中定义图形,并且定义一些效果
2,用法:
首先在drawable中新建一个xml
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF"
android:angle="270"/>
<padding android:left="50dp" android:top="20dp"
android:right="7dp" android:bottom="7dp" />
<corners android:radius="8dp" />
</shape>
然后通过android:src="@drawable/shape"或者android:background="@drawable/shape"来使用。
具体属性参考:
http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
更多drawable用法参考
http://developer.android.com/guide/topics/resources/drawable-resource.html
分享到:
相关推荐
android中shape的使用: http://blog.csdn.net/luohai859/article/details/41038443
Android中shape的使用,细致讲解shape xml的使用规则,已经案例
Android中使用Shape自定义形状
android-shape-imageview - 图片圆角、三角、五角、圆形、多角
Android中常常使用shape来定义控件的一些显示属性,接下来通过本篇文章给大家介绍Android中shape定义控件的使用,对android shape定义控件相关知识感兴趣的朋友一起学习吧
android 用shape画出来的颜色做背景时,动态的改变它的颜色属性。
利用shape优化android UI
android 代码实现shape GradientDrawable
主要介绍了android shape的使用及渐变色、分割线、边框、半透明阴影,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
Android-shape标签的使用,让我们的界面更加高大上档次
android shape的使用
ShapeDrawable是一种很常见的Drawable,可以理解为通过颜色来构造的图形,它既可以是纯色的图形,也可以是具有... android:shape=[rectangle> <corners android:radius=integer android:topLeftRadius=integer
Android shape属性详解
探索Android中selector和shape的结合使用
Android shape 属性深入用法 我的博客:http://blog.csdn.net/xiaoyuan511
详细信息可见博客,Android:shape开发详解-UI设计
Android:shape的使用详解(2)http://blog.csdn.net/wangyanguiyiyang/article/details/50060829
android shape可以帮助我们实现很多的效果,比如:圆角、虚线边框、部分圆角、颜色的渐变等效果,同时源文件给出了android4.0系统下虚线会变成实线的解决办法。