我创建了一个小应用程序,在主活动中有一个图像视图和一个按钮。按钮点击对话框打开,用户可以在画布上绘制任何东西。现在我想将此画布设置在我的主屏幕图像视图中如何设置?请参阅图像
答案 0 :(得分:0)
在您的活动中这样做
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.yourcustomview, null);//add your view from drawable folder
dialogBuilder.setView(dialogView);
EditText editText = (EditText) dialogView.findViewById(R.id.editText);//view from custom dialog
editText.setText("test");
AlertDialog alertDialog = dialogBuilder.create();
alertDialog.show();
修改:使用android:background="@drawable/your_custom_dialog"