用dialog简单实现自定义可编辑内容的弹出框。
效果图
可以自行修改成其他效果,修改下面的布局里控件就好,思路是一样的。
代码
private void inputDialog() {
android.app.AlertDialog.Builder builder=new android.app.AlertDialog.Builder(this);
View areaDialogView= LayoutInflater.from(getApplicationContext()).inflate(R.layout.area_input_dialog,null);
final EditText editText= (EditText) areaDialogView.findViewById(R.id.etInventoryAreaDialog);
editText.setInputType(InputType.TYPE_CLASS_TEXT);
String s = remarkList.get(position);
editText.setText(s);
final TextView textView= (TextView) areaDialogView.findViewById(R.id.tvInventoryAreaTitle);
editText.setHint(“请输入备注”);
textView.setText(“备注”);
editText.setTextColor(Color.BLACK);
builder.setView(areaDialogView)
.setPositiveButton(“确