在XML中設置drawableStart后勃教,第一次setAdapter后drawable顯示不對榔组,在7.0及以上機型上正常
在網(wǎng)上看了很多文章都沒有用,最后自己猜想和測試钞护,發(fā)現(xiàn)是drawable沒有刷新喉祭,在代碼中重新設置后解決养渴。
貼下代碼,希望可以幫助到別人
<RadioGroup
android:id="@+id/radiogroup"
android:orientation="horizontal"
android:gravity="center_vertical|right"
android:paddingTop="@dimen/d5"
android:paddingBottom="@dimen/d5"
android:layout_marginStart="@dimen/d10_Miss_fang"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/d40">
<RadioButton
android:id="@+id/taskinfo_1rb"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="正常"
android:textColor="@color/black_color"
android:button="@null"
android:drawableStart="@drawable/event_radiobt_selector"
android:drawablePadding="@dimen/d5"
android:background="@color/white" />
<RadioButton
android:id="@+id/taskinfo_2rb"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/d35"
android:text="異常"
android:textColor="@color/black_color"
android:button="@null"
android:drawableStart="@drawable/event_radiobt_selector"
android:drawablePadding="@dimen/d5"
android:background="@color/white"/>
</RadioGroup>
((RadioButton)helper.getView(R.id.taskinfo_1rb)).setCompoundDrawablesWithIntrinsicBounds(
Resource.drawable(R.drawable.event_radiobt_selector), null, null, null);
((RadioButton)helper.getView(R.id.taskinfo_2rb)).setCompoundDrawablesWithIntrinsicBounds(
Resource.drawable(R.drawable.event_radiobt_selector) , null, null, null);