android点击按钮弹出输入框,android 弹出框(输入框和选择框)

  • Post author:
  • Post category:其他


1、输入框:

final EditText inputServer = new EditText(this);

inputServer.setFilters(new InputFilter[]{new InputFilter.LengthFilter(50)});

AlertDialog.Builder builder = new AlertDialog.Builder(this);

builder.setTitle(“个性点的签名”).setIcon(android.R.drawable.ic_dialog_info).setView(inputServer)

.setNegativeButton(“取消”, null);

builder.setPositiveButton(“确定”, new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int which) {

String _sign = inputServer.getText().toString();

if(_sign!=null && !_sign.isEmpty())

{

signature_txt.setText(_sign);

}

else

{

Toast.makeText(MemberActivity.this,”签名为空”,Toast.LENGTH_SHORT).show();

}

}

});

builder.show();

2、选择弹出框

final S