Android: subclassing DialogPreference

末鹿安然 提交于 2019-12-11 07:25:17

问题


I am trying to create custom dialog preference that will hold radio group with two radio buttons and one 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.

I guess I have to subclass DialogPreference and put that subclass as xml element. But I don't know what methods should I override and how.

Could anyone help?


回答1:


Take a look here,

creating a DialogPreference from XML

You are correct, you need to subclass DialogPreference.



来源:https://stackoverflow.com/questions/5130342/android-subclassing-dialogpreference

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!