ANDROID SHAPE畫圓形背景實現圓形TextView
阿新 • • 發佈:2019-02-15
<?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/common_red"/><padding android:left="2dp" android:top="1dp" android:right="2dp" android:bottom="1dp"/><solid android:color="@color/common_red"/><stroke android:width="1dp" android:color="@android:color/white"/><size android:width="15dp" android:height="15dp"/></shape>
把以上程式碼新增到drawable裡面、通過background引用就可以了
<TextView android:id="@ id/message_category_unread_count" style="@style/comm_text_style_14_aaaaaa" android:layout_marginLeft="70dp" android:layout_marginTop="5dp" android:background="@drawable/design_red_point" android:gravity="center" android:textSize="@dimen/text_size_comment_20"android:text="7" android:textColor="@android:color/white"/>