Android开发之Shape的使用(为TextView等空间添加边框)
来源:互联网 发布:火线精英刷枪软件 编辑:程序博客网 时间:2024/05/24 02:39
在Android开发中,我们想为控件添加边框,可以使用Shape。
首先,我先简单介绍一下Shape。
solid:填充
gradient:渐变
stroke:描边
corners:圆角
padding:间隔
Shape的使用如下,制作椭圆形边框textview_bg.xml。
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#ffffff" /> <!-- 定义填充的颜色值 --> <stroke android:width="1dp" android:color="#000000" /> <!-- 定义描边的宽度和描边的颜色值 --> <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" /> <!-- 设置四个角的半径 --> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> <!-- 设置各个方向的间隔 --></shape>
为TextView添加Shape制作好的椭圆形边框。
android:background="@drawable/textview_bg"
0 0
- Android开发之Shape的使用(为TextView等空间添加边框)
- Android开发之为textView添加下划线,中划线等
- Android 使用shape添加边框
- Android--为TextView添加边框
- Android--为TextView添加边框
- android 为TextView添加边框
- android 为TextView添加边框
- Android 为TextView 添加边框
- android 为TextView添加边框
- Android--为TextView添加边框
- android 为TextView添加边框
- android 为TextView添加边框
- android 为TextView添加边框
- android shape的使用 边框
- Android中为textView添加边框
- android的shape(四周边框为灰色)
- android开发 -为TextView加上边框
- android里TextView加下划线的几种方式 以及 为TextView添加边框
- java学习之集合框架
- Android线性布局自适应
- box-shadow
- iOS版本判断宏
- s5pv210 移植 ubuntu(uboot + linux3.9.7 + ubuntu12.11 + xfce)
- Android开发之Shape的使用(为TextView等空间添加边框)
- ORMLite完全解析(三)官方文档第三章、自定义查询构造器 Custom Query Builder
- Leetcode: Kth Largest Element in an Array
- 基于OpenFlow交换机的OpenStack部署实践
- JMS消息服务器——Message消息分析(1)
- 在Linux上安装Memcached服务
- x264源代码简单分析:宏块编码(Encode)部分
- Neutron网络入门
- Python编写单片机上位机