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 String[] items = {"保密","男","女"}; new AlertDialog.Builder(MemberActivity.this) .setTitle("请选择") .setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { TextView item_value = (TextView)memberInfo_tab_list_2.getChildAt(2).findViewById(R.id.item_value); item_value.setText(items[which]); } }).show();
时间: 2024-12-20 16:29:18