android自定义对话框

1、开发者自定义对话框(带透明度)

final Dialog searchDialog = new Dialog(this,R.style.dialog);
   WindowManager.LayoutParams lp=searchDialog.getWindow().getAttributes();
               lp.alpha=0.9f;
              searchDialog.getWindow().setAttributes(lp);
    searchDialog.setContentView(R.layout.search_dialog);
    ImageButton imgSub=(ImageButton)searchDialog.findViewById(R.id.searchBtn);
    final EditText searchName=(EditText)searchDialog.findViewById(R.id.searchName);
    imgSub.setOnClickListener(new OnClickListener() { 
     @Override
     public void onClick(View v) {

      searchDialog.dismiss();

     }
    });
    searchDialog.show();

你可能感兴趣的:(android)