简体   繁体   中英

Android: subclassing DialogPreference

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?

Take a look here,

creating a DialogPreference from XML

You are correct, you need to subclass DialogPreference.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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