android - 如何修复 Lollipop 前设备上的复选框文本间距?

标签 android spacing android-checkbox

我有一个复选框,应用了一种样式。在 Lollipop 设备上,文本紧挨着复选框,但在 Lollipop 之前的设备上,文本距离很远。

我该如何解决这个问题?

 <style name="Widget.CheckBox" parent="android:Widget.CompoundButton.CheckBox">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginLeft">8dp</item>
        <item name="android:theme">@style/Theme.AppCompat.Light</item>
        <item name="android:textColor">@color/primary_text</item>
    </style>

Lollipop 之前的版本(特别是 4.1.1)

enter image description here

Lollipop ⇦ 这就是我希望它在所有设备上的样子

enter image description here

最佳答案

为了关闭线程,我把答案贴在这里:

解决方案是使用 parent="Widget.AppCompat.CompoundButton.CheckBox" 来支持较低的 API。

关于android - 如何修复 Lollipop 前设备上的复选框文本间距?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32419930/

相关文章:

android - 使用 ionic 在屏幕上显示手机的地理位置

iOS Autolayout 视觉格式 - 如何设置间距以尝试一个值但在小屏幕上回退到另一个值?

html - 更改列表中点内的行高(不在点之间)

android - 如何仅在选中复选框时才显示 toast 消息?

android - 选中 RecyclerView 中的所有复选框

android - 如何在某个时候取消android中以前的 Activity ?

java - 在 Android 模拟器中更改语言环境

java - 在我的应用程序中检索地理位置远不如 Google map 应用程序在我的设备上同时显示的准确

css - 更改段落之间和段落内部的间距

java - 扫描 ListView 中的复选框的方法