Android TextView(圓?。┻吙蚝捅尘皩嵗斀?/h1>
更新時間:2016年11月22日 14:41:09 投稿:lqh
這篇文章主要介紹了 Android TextView(圓?。┻吙蚝捅尘皩嵗斀獾南嚓P資料,這里提供了實現(xiàn)代碼和實現(xiàn)效果圖,需要的朋友可以參考下
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文件實現(xiàn)

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中的RecyclerView新組件初步上手指南
RecyclerView是Android L版本開始采用的一個組件,被人們認為用來代替?zhèn)鹘y(tǒng)的ListView,下面我們就一起來看一下Android中的RecyclerView新組件初步上手指南 2016-06-06
-
android popuwindow點擊外部窗口不消失的實例
下面小編就為大家?guī)硪黄猘ndroid popuwindow點擊外部窗口不消失的實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧 2017-04-04
-
Android中Intent傳遞對象的兩種方法Serializable,Parcelable
這篇文章主要介紹了Android中的傳遞有兩個方法,一個是Serializable,另一個是Parcelable,對intent傳遞對象的兩種方法感興趣的朋友一起學習吧 2016-01-01
-
Android開發(fā)Jetpack組件Room用例講解
這篇文章主要為大家介紹了Android?Jetpack組件Room的使用案例的詳細講解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步 2022-02-02
-
詳解Android獲取系統(tǒng)內(nèi)核版本的方法與實現(xiàn)代碼
這篇文章主要介紹了詳解Android獲取系統(tǒng)內(nèi)核版本的方法與實現(xiàn)代碼的相關資料,這里提供了具體實現(xiàn)獲取內(nèi)核的方法,需要的朋友可以參考下 2017-07-07
最新評論
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文件實現(xiàn)

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中的RecyclerView新組件初步上手指南
RecyclerView是Android L版本開始采用的一個組件,被人們認為用來代替?zhèn)鹘y(tǒng)的ListView,下面我們就一起來看一下Android中的RecyclerView新組件初步上手指南2016-06-06
android popuwindow點擊外部窗口不消失的實例
下面小編就為大家?guī)硪黄猘ndroid popuwindow點擊外部窗口不消失的實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-04-04
Android中Intent傳遞對象的兩種方法Serializable,Parcelable
這篇文章主要介紹了Android中的傳遞有兩個方法,一個是Serializable,另一個是Parcelable,對intent傳遞對象的兩種方法感興趣的朋友一起學習吧2016-01-01
Android開發(fā)Jetpack組件Room用例講解
這篇文章主要為大家介紹了Android?Jetpack組件Room的使用案例的詳細講解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步2022-02-02
詳解Android獲取系統(tǒng)內(nèi)核版本的方法與實現(xiàn)代碼
這篇文章主要介紹了詳解Android獲取系統(tǒng)內(nèi)核版本的方法與實現(xiàn)代碼的相關資料,這里提供了具體實現(xiàn)獲取內(nèi)核的方法,需要的朋友可以參考下2017-07-07

