自定义AlertDialog,去掉黑色边框

1:实现方法
	private void showCancelDialog() {
		// TODO Auto-generated method stub
		 AlertDialog.Builder builder=new AlertDialog.Builder(this);
		dialog=builder.create();
		dialog.show();
		final Window window = dialog.getWindow();
		window.setContentView(R.layout.dialog_cancel);
		 Button cancelBtn=(Button)window.findViewById(R.id.cancel_btn);
		 Button continueBtn=(Button)window.findViewById(R.id.continue_btn);
		 cancelBtn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		 continueBtn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				dialog.dismiss();
			}
		});

	}
2.对话框布局



    

    

    

        

        

            


3:对话框背景

  
  
  
      
  
      
  
      
  
      
  


你可能感兴趣的:(android)