Android 为什么自定义复选框文本视图覆盖复选框按钮?
在这里,我使用自定义复选框,但查看复选框覆盖按钮。 我该怎么办?我尝试一些填充,但它的工作一些设备很好,但在一些文本显示更多的左padding,而在一些覆盖我应该做什么 下面是xml代码Android 为什么自定义复选框文本视图覆盖复选框按钮?,android,checkbox,textview,padding,Android,Checkbox,Textview,Padding,在这里,我使用自定义复选框,但查看复选框覆盖按钮。 我该怎么办?我尝试一些填充,但它的工作一些设备很好,但在一些文本显示更多的左padding,而在一些覆盖我应该做什么 下面是xml代码 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="sportsquiz.QuizActivity" >
<TextView
android:id="@+id/question_noID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<TextView
android:id="@+id/txt_questionID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="TextView"
android:textAlignment="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#DCE3E6" >
请任何人帮帮我我这里缺少什么试试这个
<CheckBox
android:id="@+id/chk_ans3ID"
android:layout_width="64dp"
android:layout_height="64dp"
android:drawableLeft="@drawable/custom_checkbox"
android:button="@null"
android:drawablePadding="5dp"
android:text="CheckBox"
android:background="#00000000"/>
试试这个
<CheckBox
android:id="@+id/chk_ans3ID"
android:layout_width="64dp"
android:layout_height="64dp"
android:drawableLeft="@drawable/custom_checkbox"
android:button="@null"
android:drawablePadding="5dp"
android:text="CheckBox"
android:background="#00000000"/>
试试这个
android:id="@+id/chk_ans1ID"
android:layout_width="match_parent"
android:layout_height="64dp"
android:drawableLeft="@drawable/custom_checkbox"
android:onClick="onCheckboxClicked"
android:button="@null"
android:drawablePadding="5dp"
android:text="CheckBox"
android:background="#00000000"/>
对于java代码
ans_1.setCompoundDrawablesWithIntrinsicBounds
(R.drawable.custom_复选框_交叉,0,0,0) 试试这个
android:id="@+id/chk_ans1ID"
android:layout_width="match_parent"
android:layout_height="64dp"
android:drawableLeft="@drawable/custom_checkbox"
android:onClick="onCheckboxClicked"
android:button="@null"
android:drawablePadding="5dp"
android:text="CheckBox"
android:background="#00000000"/>
对于java代码
ans_1.setCompoundDrawablesWithIntrinsicBounds
(R.drawable.custom_复选框_交叉,0,0,0)