Using EditTextPreference with 2 user input fields

后端 未结 1 2120
失恋的感觉
失恋的感觉 2021-02-15 16:24

I would like to use EditTextPreference to show 2 input fields instead of 1. For instance, a username and password field should be shown. I don\'t want to use a dialog for each o

1条回答
  •  醉梦人生
    2021-02-15 16:48

    You can use a DialogPreference and create your own layout for the input fields you require.

    DialogPreference is abstract so you'll need to create your own subclass of it, adding an implementation of onDialogClosed() to save the values from the dialog as Preferences.

    You can still reference your own class in a Preferences XML file by using the class as the XML tag. For example:

    
    

    0 讨论(0)
提交回复
热议问题