Android 复选框显示为大于其正常大小
在下面的xml代码中,我显示了Android 复选框显示为大于其正常大小,android,android-layout,android-checkbox,Android,Android Layout,Android Checkbox,在下面的xml代码中,我显示了复选框它看起来比它的正常大小大。但是在其他xml代码中,它看起来很好 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_co
复选框
它看起来比它的正常大小大。但是在其他xml代码中,它看起来很好
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dip"
android:background="@android:color/transparent"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_bg_provide_shadow"
android:padding="@dimen/padding_small" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/dialog_back_gradient"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1_hiddenactivity"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="10dip"
android:text="You have disabled Mobile Data in the settings.An app is trying to use it.Do you want to allow?"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#40342c" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:orientation="vertical"
android:padding="10dip" >
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:clickable="false"
android:text="Ashis Sharma " />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip" >
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
<Button
android:id="@+id/enable_data_yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/small_ok_selector" />
<Button
android:id="@+id/enable_data_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:background="@drawable/small_cancel_selector" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
在复选框中尝试手动提供您的尺码。
请在复选框中尝试手动指定您的尺寸。创建两幅图像,如下所示: 命名为check和check1 在drawable文件夹中立即创建xml文件 名称:checkbox.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/check1" android:state_checked="true"/>
<item android:drawable="@drawable/check" android:state_checked="false"/>
</selector>
并重新封装xml文件代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dip"
android:background="@android:color/transparent"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_bg_provide_shadow"
android:padding="@dimen/padding_small" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/dialog_back_gradient"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1_hiddenactivity"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="10dip"
android:text="You have disabled Mobile Data in the settings.An app is trying to use it.Do you want to allow?"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#40342c" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="horizontal"
android:padding="10dip" >
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="15dp"
android:layout_height="15dp"
android:button="@drawable/checkbox"
android:checked="true"
android:text=" " />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Ashis Sharma"
android:textSize="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip" >
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
<Button
android:id="@+id/enable_data_yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/small_ok_selector" />
<Button
android:id="@+id/enable_data_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:background="@drawable/small_cancel_selector" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
最终输出:
创建如下两个图像: 命名为check和check1 在drawable文件夹中立即创建xml文件 名称:checkbox.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/check1" android:state_checked="true"/>
<item android:drawable="@drawable/check" android:state_checked="false"/>
</selector>
并重新封装xml文件代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dip"
android:background="@android:color/transparent"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_bg_provide_shadow"
android:padding="@dimen/padding_small" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/dialog_back_gradient"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1_hiddenactivity"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="10dip"
android:text="You have disabled Mobile Data in the settings.An app is trying to use it.Do you want to allow?"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#40342c" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="horizontal"
android:padding="10dip" >
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="15dp"
android:layout_height="15dp"
android:button="@drawable/checkbox"
android:checked="true"
android:text=" " />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Ashis Sharma"
android:textSize="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip" >
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
<Button
android:id="@+id/enable_data_yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/small_ok_selector" />
<Button
android:id="@+id/enable_data_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:background="@drawable/small_cancel_selector" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
最终输出:
请更好地解释问题所在。我真的不知道你在问什么。。。你是指
复选框周围的填充吗?
?添加一个更容易理解的屏幕截图。请更好地解释问题所在。我真的不知道你在问什么。。。你是指复选框周围的填充物吗?
?添加一个更容易理解的屏幕截图。它不是单选按钮。。。。检查我的xml代码…我正在描述复选框…试试它…它不是单选按钮。。。。检查我的xml代码…我正在描述复选框…尝试一下。。。。