声明一个AlertDialog aDialog;成员
- aDialog= new AlertDialog.Builder(second. this )
- .setTitle(R.string.app_name)
- .setMessage(R.string.hello)
- .show();
- aDialog.getWindow().setLayout(120 , 160 );
- aDialog.getWindow().setContentView(R.layout.main);
- Button btn=(Button)aDialog.getWindow().findViewById(R.id.btn1);
- btn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- // TODO Auto-generated method stub
- aDialog.dismiss();
- AlertDialog dlg1=new AlertDialog.Builder(second. this )
- .setTitle(R.string.app_name)
- .setMessage(R.string.hello)
- .setPositiveButton(
- R.string.str_ok,null )
- .show();
- }
- });