creating a DialogPreference from XML

后端 未结 3 1932
旧时难觅i
旧时难觅i 2020-11-30 01:39

I have been attempting to use an android.preference.DialogPreference inflated from XML, but the documentation seems to be missing some essential bits, and I can

3条回答
  •  孤街浪徒
    2020-11-30 02:26

    This one is weird, you need to subclass DialogPreference. The subclass does not need to do anything. So

    public class MyDialogPreference extends DialogPreference {
    
        public MyDialogPreference(Context context, AttributeSet attrs) {
            super(context, attrs);
            // TODO Auto-generated constructor stub
        }
    
    } 
    

    can be instantiated. While a plane old DialogPreference can not. Very weird, they should be the exact same thing.

提交回复
热议问题