Android TextView边框和背景,以及圆形背景
来源:互联网 发布:机器学习 预测算法 编辑:程序博客网 时间:2024/06/06 03:20
效果图:
布局代码:
<TextView android:id="@+id/product_tag" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:singleLine="true" android:textSize="10sp" android:textColor="@color/label_orange" android:layout_marginLeft="10dp" android:background="@drawable/shape_label_orange" android:text="标签"/>
样式代码:
弧度和背景主要靠background中的.xml文件实现
1、
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 实心 --> <solid android:color="@android:color/white"/> <!-- 边框 --> <stroke android:width="0.5dp" android:color="@color/label_orange"/> <!-- 圆角 --> <corners android:radius="3dp"/> <!-- 边距 --> <padding android:top="2dp" android:bottom="2dp" android:left="6dp" android:right="6dp"/></shape>
2、
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" android:useLevel="false"> <!-- 实心 --> <solid android:color="@color/label_round_orange" /> <!-- 圆角 --> <corners android:radius="360dp" /> <!-- 边距 --> <padding android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp" /> <!-- 大小 --> <size android:width="15dp" android:height="15dp" /></shape>
注释:
radius:180是椭圆角、360是圆角
1 0
- Android TextView边框和背景,以及圆形背景
- Android TextView边框和背景,以及圆形背景
- 自己设置textview的边框和背景以及圆形背景
- 圆形背景TextView
- ANDROID SHAPE画圆形背景实现圆形TextView
- ANDROID SHAPE画圆形背景实现圆形TextView
- android 自定义边框和背景
- 自定义圆形背景的TextView
- android shape 圆形背景
- android 圆形虚线背景
- Android制作圆形背景
- Android给TextView设置透明背景、圆角边框
- android 圆角边框、渐变背景的TextView
- Android给TextView设置透明背景、圆角边框
- android 圆角边框、渐变背景的TextView
- android 背景边框变圆角
- android 背景边框变圆角
- android边框背景
- XCode中在提示窗口中对已弃用的API接口画上红线
- iOS后台如何保持socket长连接和数据传输
- Cannot change version of project facet Dynamic Web Module to 2.4
- php 中mysql_affected_rows()
- nyoj 284
- Android TextView边框和背景,以及圆形背景
- JavaScript基础学习(四)-Array对象
- 利用百度地图API制作城中心交通时空圈
- 设计模式-工厂模式
- [转载]How To Set Up And Use X11 Forwarding On Linux And Mac
- Extjs搜索 重置搜索框 关于页码问题 向后台传递排序参数 向后台传递参数
- java ThreadPoolExecutor
- Shader之学习笔记三
- ERROR: JDWP Unable to get JNI 1.2 environment解决办法