android画图-----shape的使用
在GradientDrawable1试图中终于把shape学会了,以前总是似懂非懂,
现在终于把里面的东西搞清楚了,同时也挺佩服谷歌的用心,故意设 置一些陷阱吧,不认真对待还真以为没有啥效果呢。
setContentView(R.layout.shape_drawable_1)
shape_drawable_1 代码如下:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_1" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/line" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_2" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/line" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_3" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="20dip"
android:src="@drawable/line" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_4" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/line" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_5" />
</LinearLayout>
</ScrollView>
shape_5的代码:
<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>
gradient 产生颜色渐变 android:angle 从哪个角度开始变 貌似只有90的整数倍可以
android:shape="rectangle" 默认的也是长方形
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="#ff4100ff"/>
<stroke android:width="2dp" android:color="#ee31ff5e"
android:dashWidth="3dp" android:dashGap="2dp" />
<padding android:left="7dp" android:top="7dp"
android:right="7dp" android:bottom="7dp" />
<corners android:radius="6dp" />
</shape>
#ff4100ff蓝色#ff4100ff绿色
<solid android:color="#ff4100ff"/>实心的 填充里面
<stroke 描边 采用那样的方式将外形轮廓线画出来
android:dashWidth="3dp" android:dashGap="2dp" 默认值为0
android:width="2dp" android:color="#FF00ff00"笔的粗细,
android:dashWidth="5dp" android:dashGap="5dp" 实现- - -这样的效果,dashWidth指的是一条小横线的宽度
dashGap 指的是 小横线与小横线的间距。 width="2dp" 不能太宽
分享到:
相关推荐
主要介绍了android shape的使用及渐变色、分割线、边框、半透明阴影,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
android 代码实现shape GradientDrawable
Android中使用Shape自定义形状
android 用shape画出来的颜色做背景时,动态的改变它的颜色属性。
android shape可以帮助我们实现很多的效果,比如:圆角、虚线边框、部分圆角、颜色的渐变等效果,同时源文件给出了android4.0系统下虚线会变成实线的解决办法。
android shape的使用
android-shape-imageview - 图片圆角、三角、五角、圆形、多角
Android shape属性详解
1.实现阴影或模糊边效果方式: 2.通过shape来实现,具体是通过layer-list 多层叠放的方式实现的 <?xml version=1.0 encoding=utf-8?> <layer-list xmlns:android=...
Android shape 属性深入用法 我的博客:http://blog.csdn.net/xiaoyuan511
Android Shape源码实例,通过shape可以为为视图设置圆角背景,既可以通过在xml文件中直接为视图设置背景,又可以通过在代码中动态设置。
利用shape优化android UI
Android-shape标签的使用,让我们的界面更加高大上档次
本文实例讲述了Android编程使用自定义shape实现shadow阴影效果的方法。分享给大家供大家参考,具体如下: 直接上xml文件, 并且附上相应的解析: <?xml version=1.0 encoding=utf-8?> <selector xmlns:android...
Android控件美化之Shape的使用 里面事例非常好的。
Android shape 绘制图形 Android 绘制图形可以使用shape也可以使用自定义控件的方式,这里我们说下shape的方式去实现。 在绘制图形之前,我们先来了解下shape的几个属性。 shape /* * 线行 圆形 矩形 / android:...
介绍Shape支持的4种图形3种渐变色类型,包含demo程序与文档。
Android:shape的使用详解(2)http://blog.csdn.net/wangyanguiyiyang/article/details/50060829
android中shape的使用: http://blog.csdn.net/luohai859/article/details/41038443