0
我有我的看法是動態變化的android:drawableEnd /右上的TextView沒有出現在SDK 4.1
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@+id/txt_suburb"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/default_ripple_selector"
android:clickable="true"
android:drawableEnd="@drawable/image_one"
android:drawableRight="@drawable/image_one"
android:minHeight="20dp"
android:orientation="vertical"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="@color/black" />
我動態改變權繪製對象。
textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, chooseImageTwo?
R.drawable.image_two: R.drawable.image_one, 0);
它適用於所有版本,Android版本4.1除外。 (請注意,4.1中最舊的支持版本)。有什麼問題?
嘗試在設置可繪製線後添加textView.requestLayout()和textView.refreshDrawableState()。 –