Android: subclassing DialogPreference

2019-08-03 02:51发布

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条回答
三岁会撩人
2楼-- · 2019-08-03 03:33

Take a look here,

creating a DialogPreference from XML

You are correct, you need to subclass DialogPreference.

查看更多
登录 后发表回答