简体   繁体   English

Android:子类化DialogPreference

[英]Android: subclassing DialogPreference

I am trying to create custom dialog preference that will hold radio group with two radio buttons and one edittext. 我正在尝试创建自定义对话框首选项,该首选项将包含具有两个单选按钮和一个edittext的单选组。 If I write something like 如果我写这样的话

<DialogPreference android:title="preftitle" android:dialogLayout="@layout/preflayout" android:summary="pref summary" android:key="prefkey" android:defaultValue="defaultValue" />
the application breaks when trying to create PreferenceActivity that holds this dialog preference. 尝试创建包含此对话框首选项的PreferenceActivity时,应用程序中断。

I guess I have to subclass DialogPreference and put that subclass as xml element. 我想我必须继承DialogPreference并将其作为xml元素。 But I don't know what methods should I override and how. 但是我不知道应该重写哪些方法以及如何重写。

Could anyone help? 有人可以帮忙吗?

Take a look here, 看这里

creating a DialogPreference from XML 从XML创建DialogPreference

You are correct, you need to subclass DialogPreference. 没错,您需要子类DialogPreference。

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

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