博客
关于我
Android使用xml的shape自定义图形
阅读量:351 次
发布时间:2019-03-04

本文共 886 字,大约阅读时间需要 2 分钟。

android:shape=[“rectangle” | “oval” | “line” | “ring”]
shape的形状,默认为矩形,可以设置为矩形(rectangle)、椭圆形(oval)、线性形状(line)、环形(ring)

1.自定义纯色圆形
round.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"       android:shape="rectangle" >    <solid android:color="#283593"/>    <corners android:radius="50dp" /></shape>
//半径为50dp,颜色为#283593的圆形<ImageView    android:layout_width="50dp"    android:layout_height="50dp"    android:scaleType="center"    android:src="@drawable/manual_tuner_band_bg" />

2.自定义纯色矩形
rectangle.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"       android:shape="rectangle" >    <solid android:color="#283593"/>    <corners android:radius="50dp" /></shape>
//宽为30dp,高为50dp,颜色为#283593的矩形<ImageView    android:layout_width="30dp"    android:layout_height="50dp"    android:scaleType="center"    android:src="@drawable/manual_tuner_band_bg" />

转载地址:http://ysre.baihongyu.com/

你可能感兴趣的文章
Objective-C实现混沌算法(附完整源码)
查看>>
Objective-C实现温度转换算法(附完整源码)
查看>>
Objective-C实现滑动平均滤波(附完整源码)
查看>>
Objective-C实现滤波器(附完整源码)
查看>>
Objective-C实现灰度直方图(附完整源码)
查看>>
Objective-C实现点的多项式算法(附完整源码)
查看>>
Objective-C实现牛顿下山法(附完整源码)
查看>>
Objective-C实现牛顿插值法(附完整源码)
查看>>
Objective-C实现牛顿法求一个数的平方根算法 (附完整源码)
查看>>
Objective-C实现牛顿法算法(附完整源码)
查看>>
Objective-C实现牛顿迭代法(附完整源码)
查看>>
Objective-C实现特征脸算法(附完整源码)
查看>>
Objective-C实现状态模式(附完整源码)
查看>>
Objective-C实现狄克斯特拉算法(附完整源码)
查看>>
Objective-C实现狄克斯特拉算法(附完整源码)
查看>>
Objective-C实现猜数字游戏(附完整源码)
查看>>
Objective-C实现猜数字算法(附完整源码)
查看>>
Objective-C实现猴子爬山算法(附完整源码)
查看>>
Objective-C实现环形缓冲区(附完整源码)
查看>>
Objective-C实现生产者和消费者问题(附完整源码)
查看>>