1
色の付いた円の中央に数字を表示します。私の問題は、円とテキストを特定のサイズで表示する必要がありますが、テキストが隠れていることです。円の半径を大きくすると、テキストが表示されます。ここに私のコードは次のとおりです。TextViewでシェイプの背景を使用する場合のテキストの隠蔽 - Android
<TextView
android:layout_width="20dp"
android:layout_height="20dp"
android:textColor="@color/black"
android:gravity="center_vertical|center_horizontal"
android:text="2"
android:background="@drawable/circle"
android:textSize="12sp"
/>
と形状:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#0196C0"/>
<padding android:bottom="10dp"
android:right="10dp"
android:top="10dp"
android:left="10dp"></padding>
</shape>