android - 如何对齐android中的单选按钮

标签 android

我正在尝试在我的 android 应用程序中使用单选组/单选按钮的以下示例。 http://www.androidpeople.com/android-radiobutton-example/

但是单选按钮在标签(文本)的左侧。

你能告诉我如何配置它,使单选按钮位于标签的右侧吗?文本与父级左对齐,单选按钮与父级右对齐?

谢谢。

最佳答案

右侧对齐的单选按钮:

<RadioButton
                    android:id="@+id/radio0"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:background="@null"
                    android:button="@null"
                    android:checked="true"
                    android:drawableRight="@drawable/presets_sel"
                    android:padding="12dp"
                    android:text="RadioButton 1" />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/right_arrow_h" android:state_checked="true"/>
    <item android:drawable="@drawable/right_arrow_h" android:state_pressed="true"/>
    <item android:drawable="@drawable/right_arrow"></item>

</selector>

关于android - 如何对齐android中的单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3327977/

相关文章:

Android FFmpeg : Undefined references to atof, log2 & log2f

java - 数据类型参数旁边的省略号是什么意思?

android - 在不同的语言环境中测试 Android 应用程序

调用驻留在 Android 库项目中的 native 函数时出现 Android NDK UnsatisfiedLinkError

java - 使用 7mb RAM 的 Android FinalizerReference

java - 我可以限制 ViewFlipper 在执行 AsyncTask 之前翻转吗?

android - 注册结束时发生 Logcat 错误

database - 需要有关在 Android 上加密/解密存储在 SQLite 数据库中的数据的好方法的建议

android - 如何通过 API instagram 获取所有 Instagram 帖子评论?

java - 如何在 TextView 的扩展类中正确绘制文本?