博客
关于我
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实现binary exponentiation二进制幂运算算法(附完整源码)
查看>>
Objective-C实现hardy ramanujana定理算法(附完整源码)
查看>>
Objective-C实现insertion sort插入排序算法(附完整源码)
查看>>
Objective-C实现Interpolation search插值查找算法(附完整源码)
查看>>
Objective-C实现k-nearest算法(附完整源码)
查看>>
Objective-C实现KPCA(附完整源码)
查看>>
Objective-C实现max subarray sum最大子数组和算法(附完整源码)
查看>>
Objective-C实现md5算法(附完整源码)
查看>>
Objective-C实现miller rabin米勒-拉宾素性检验算法(附完整源码)
查看>>
Objective-C实现not gate非门算法(附完整源码)
查看>>
Objective-C实现segment tree段树算法(附完整源码)
查看>>
Objective-C实现SinglyLinkedList单链表算法(附完整源码)
查看>>
Objective-C实现二进制补码算法(附完整源码)
查看>>
Objective-C实现删除重复的字母字符算法(附完整源码)
查看>>
Objective-C实现单例模式(附完整源码)
查看>>
Objective-C实现单向链表的反转(附完整源码)
查看>>
Objective-C实现压缩文件夹(附完整源码)
查看>>
Objective-C实现图书借阅系统(附完整源码)
查看>>
Objective-C实现图片的放大缩小(附完整源码)
查看>>
Objective-C实现均值滤波(附完整源码)
查看>>