RadioButton 文本 Android API 16

RadioButton text Android API 16

我在 Android API 16 上遇到 RadioButton 问题。较新的 API 级别不存在此问题。我在 API 16 中发现了许多与 RadioButton 相关的其他问题,但其中 none 解决了我的问题。 RadioButton 的文本从 Checkbox 内部开始,这里是屏幕截图。我希望有人能帮我找到解决方法,因为我现在找不到。

高度和宽度在"wrap_content" 左边的有 paddingRight="10dp",右边的有 paddingLeft="10dp"

谢谢

如果您不需要,只需删除填充.. 一切都会就位。

所以我找到了解决方法,因为我发现了问题所在,感谢 sourabh 和 this post

On API <= 16 you can set padding left on the radio button to set the padding relative to the radio button's view bounds. Additionally a patch nine background also changes the view bounds relative to the view.

我还使用 this post 为右键构建我的解决方案:

layout.xml

<RadioButton
    android:id="@+id/radio_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:test="some text"
    android:paddingLeft="@dimen/paddingLeft_radioButton" />

values/dimens.xml

<dimen name="paddingLeft_radioButton">43dp</dimen>

values-v14/dimens.xml

<dimen name="paddingLeft_radioButton">37dp</dimen>

values-v17/dimens.xml

<dimen name="paddingLeft_radioButton">10dp</dimen>