安卓中在代码中设置dialog的样式

直接在代码中设置dialog的样式,代码如下:

public void onClick(View v) {
            final EditText inputServer = new EditText(ActivityAccoutManage.this);
            inputServer.setSelectAllOnFocus(true);
            AlertDialog.Builder builder = new AlertDialog.Builder(Activity.this);
            builder.setTitle("设置标题")

                    .setView(inputServer)
                    .setNegativeButton("取消", null)
                    .setPositiveButton("确定", new DialogInterface.OnClickListener() {

 public void onClick(DialogInterface dialog, int which) {
    Toast.makeText(Activity.this, "确定", Toast.LENGTH_LONG).show();
    }
  });
   builder.show();
  }

你可能感兴趣的:(android,dialog)