自定义Dialog,带textview,EditText,Button

代码:

 

LayoutInflater inflater=getLayoutInflater();
      View layout=inflater.inflate(R.layout.request_info,(ViewGroup)findViewById(R.id.request_dialog));
      new AlertDialog.Builder(VisitorGrid.this)
      .setTitle("填写消息").setView(layout).
      setPositiveButton("确定",new DialogInterface.OnClickListener(){

       @Override
       public void onClick(DialogInterface dialog, int which) {
        // TODO Auto-generated method stub
        dialog.dismiss();
//        邀请指令格式:requestfriend#发送方#邀请方#附加信息
        
       }
       
      })
      .setNegativeButton("取消",new DialogInterface.OnClickListener(){

       @Override
       public void onClick(DialogInterface dialog, int which) {
        // TODO Auto-generated method stub
        dialog.dismiss();
       }
       
      }).show();

 

布局文件:


 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_height="wrap_content" android:layout_width="wrap_content"
 android:orientation="vertical"
 android:id="@+id/request_dialog"
>
   android:id="@+id/request_title"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="验证消息:"
 />
   android:id="@+id/request_content"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
 />
 

 

你可能感兴趣的:(自定义Dialog,带textview,EditText,Button)