简体   繁体   English

如何在一行中的android偏好设置xml中添加单选按钮?

[英]How to add radio group button in preference xml in android in one row?

I'm trying from this xml and want to add radio button but not getting solution . 我正在尝试从这个xml并想添加单选按钮,但没有得到解决方案。 Here i am not getting proper solution .so suggest me . 在这里我没有得到适当的解决方案。所以建议我。 Here also attach image which type UI iwant from using Preference screen. 在此还附加了使用“首选项”屏幕键入UI类型的图像。

    <Preference

        android:key="@string/pref_key_passcode_toggle"
        android:persistent="false"
        android:widgetLayout="@layout/check_custom"
        android:title="@string/passcode_turn_on" />

    <Preference
        android:minHeight="10dp"
        android:key="@string/pref_key_change_passcode"
        android:persistent="false"
        android:title="@string/passcode_change_passcode"

        />
    <Preference
        android:height="40dp"
        android:key="@string/pref_key_change_password"
        android:persistent="false"
        android:title="@string/password_change"
        />

</PreferenceCategory>

我想仅使用首选项xml获得此图像类型UI。

All EXISTING preferences can be found here . 可以在此处找到所有现有的首选项。 If you're not too picky on showing all the options at all times, you can use ListPreference. 如果您不太愿意随时显示所有选项,则可以使用ListPreference。 It will only show the currently selected option in the layout. 它只会在布局中显示当前选择的选项。 When the user selects it, a dialog will be shown displaying the list of all options to choose from. 当用户选择它时,将显示一个对话框,显示所有选项的列表。

If you truly want it to look like the image above, you'll need to extends Preference and implement your own MultiSelectPreference. 如果您确实希望它看起来像上面的图像,则需要扩展Preference并实现自己的MultiSelectPreference。 You can specify your own layout and use standard widgets to design it exactly how you want it to look. 您可以指定自己的布局,并使用标准的小部件来精确地设计其外观。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM