Android TextView(圆弧)边框和背景实例详解

Android TextView(圆弧)边框和背景实例详解,第1张

概述 AndroidTextView圆弧效果图:布局代码:<TextViewandroid:id=\"@+id/product_tag\"android:layout_width=\"wrap_content\"

 AndroID TextVIEw 圆弧

效果图:

布局代码:

<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> 

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

总结

以上是内存溢出为你收集整理的Android TextView(圆弧)边框和背景实例详解全部内容,希望文章能够帮你解决Android TextView(圆弧)边框和背景实例详解所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1147584.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存