View的圆背景以及圆角矩形背景
来源:互联网 发布:张博士医考中心网络课 编辑:程序博客网 时间:2024/05/16 11:54
这是2个小东西,但是经常用到。总结一下
shape有4种:
<!--android:shape=["rectangle" | "oval" | "line" | "ring"]--><!--shape的形状,默认为矩形,可以设置为矩形(rectangle)、椭圆形(oval)、线性形状(line)、环形(ring)-->
有时候设置圆形背景的时候,还会有useLevel这个属性,不知道有什么用。没有也可以运行
<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" android:useLevel="false"> ...... ......</shape>
1、圆背景
无边缘的圆背景
有边缘的圆背景
源码:
<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <solid android:color="#00ff00"/> <!--<stroke--> <!--android:width="1dp"--> <!--android:color="@android:color/white"/>--> <size android:width="25dp" android:height="25dp"/></shape>
引用:
<TextView android:id="@+id/tv_number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/design_circle_bg" android:gravity="center" android:text="1" />
2、圆角矩形
源码
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!--圆角度数--> <corners android:radius="13dp" /> <!--边宽宽度及边宽颜色--> <stroke android:width="1dp" android:color="#ccffffff"/> <!--背景--> <solid android:color="#55000000" /></shape>
0 0
- View的圆背景以及圆角矩形背景
- 定义圆角矩形背景
- android圆角矩形背景
- android圆角矩形有背景颜色
- 345_圆角矩形背景
- 安卓如何设置控件的圆角矩形背景
- 工具类:通过shape来设置圆角矩形背景
- android editText 自定义为圆角矩形背景
- view的背景
- view的模糊背景
- 圆角背景的ListView
- 圆角背景的ListView
- android自定义view控件之一圆角背景TextView
- 自定义View之自定义按键圆角边框背景
- android View使用shape作为背景不能指定单边圆角的xml
- CSS圆角背景
- 圆角背景
- android 圆角背景
- 【Arduino】1.7 点亮RGB LED
- caffe的create_lmdb.bat
- mysql索引
- xml文件引入另一个xml文件的布局
- PHP页面和Mysql数据库的转UTF8编码问题总结
- View的圆背景以及圆角矩形背景
- QWidget设置边框(样式,宽度及颜色)
- Kubernetes生产环境经验告诉你如何实现蓝绿部署和负载均衡
- LeetCode 140 Word Break II
- 【测试】Alpha 测试和 beta 测试区别到底在哪儿?
- Android 动画
- Java 序列化
- 图像FFT
- 微信端开发H5页面的时候,audio标签在苹果机上无法进行自动播放