是否可以使用可繪製元素在其背景上添加填充到TextView中?或者我需要使用Draw 9-patch?添加填充到帶有可繪製背景的textView
<TextView
android:layout_width="wrap_content"
android:layout_gravity="bottom|left"
android:layout_marginLeft="5dp"
android:layout_height="85dp"
android:background="@drawable/text_background"
android:id="@+id/counter"
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="bold"
android:gravity="center"
android:paddingLeft="2dp"
android:paddingRight="2dp"
/>
此填充設置不起作用。對於3-4位數字,背景可以正確顯示,但是應該調整(對於5/6位數字),它保持不變。
更新 - 添加圖像
'android:drawablePadding'將在文本和可繪製文件之間創建一個填充間隙 –
@Mohit Kacha不幸的是,這個參數不起作用 – Expiredmind
你使用的是relativelayout?linearlayout? –