该代码片段是通过AlertDialog实现文件(文件夹)的重命名,弹出AlertDialog后选中文件名,并弹出输入法软件,最终完成重命名。
LayoutInflater inflater = LayoutInflater.from(context);
View dialogview = inflater.inflate(R.layout.create_new_folder_dialog,null);
Button cancel = (Button) dialogview.findViewById(R.id.create_cancel);
Button ensure = (Button) dialogview.findViewById(R.id.create);
TextView title = (TextView) dialogview.findViewById(R.id.title);
TextView title2 = (TextView) dialogview.findViewById(R.id.title2);
title.setText("重命名");
title2.setText("输入新名字");