creating a DialogPreference from XML

后端 未结 3 1921
旧时难觅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:39

    First:

    Create your own class which extends DialogPreference as bellow:

    package com.test.view;
    
    import android.preference.DialogPreference;
    
    public class DialogExPreference extends DialogPreference 
    {
        public DialogExPreference(Context oContext, AttributeSet attrs)
        {
            super(oContext, attrs);     
        }
    }
    

    Second:

    Modify the xml file as bellow:

    
    
         
    
    
    

    Then it's OK.

提交回复
热议问题