我尝试使用左边的复合Drawable复选框,如下所示:
holder.selCategoryCheckBox.setCompoundDrawablesWithIntrinsicBounds(imageResource, 0, 0, 0);
的xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<CheckBox
android:id="@+id/category_sel_checkbox"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/categorySelectionOptions"
android:layout_toStartOf="@+id/categorySelectionOptions"
android:drawablePadding="@dimen/more_than_big_padding"
android:paddingLeft="@dimen/big_padding"
android:paddingTop="@dimen/big_padding"
android:paddingBottom="@dimen/big_padding"
android:singleLine="true"
android:textSize="18sp"
android:layout_marginLeft="@dimen/five_margin"
android:layout_marginStart="@dimen/five_margin"/>
<ImageView
android:id="@+id/categorySelectionOptions"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginLeft="@dimen/main_middle_margin"
android:layout_marginStart="@dimen/main_middle_margin"
android:background="@drawable/row_selector_list_dots"
android:clickable="true"
android:src="@drawable/ic_action_drawer_dots"
android:contentDescription="@string/image"
android:layout_centerVertical="true" />
在Android 4.3上Jelly Bean和Up工作正常:
但是在Android 4.2 Jelly Bean和下面的间距被破坏了:
一些想法,有什么不对?
答案 0 :(得分:1)
临时解决方法:
mdb file