自定义对话框

推荐安卓开发神器(里面有各种UI特效和android代码库实例)

LayoutInflater factory = LayoutInflater.from(Test.this);  
        final View textEntryView = factory.inflate(R.layout.test, null);  
        AlertDialog dlg = new AlertDialog.Builder(Test.this)  
        .setTitle("Input password")  
        .setView(textEntryView)  
        .setPositiveButton("OK", new DialogInterface.OnClickListener() {  
            public void onClick(DialogInterface dialog, int whichButton) {  
                EditText etPassword = (EditText)textEntryView.findViewById(R.id.et_name);   
            }       
        })  
        .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {  
            public void onClick(DialogInterface dialog, int whichButton) {  
                //finish();  
            }  
        })  
        .create();  
        dlg.show();

 

你可能感兴趣的:(自定义)