在对话框中设置视图插入可绘制的图像如何在Android中设置
-
28-09-2019 - |
题
我正在在此应用程序中实现拼图游戏应用程序,在单击“拼图”的按钮显示中的一个按钮中。原始图像在对话框中显示,然后单击“确定”返回实际页面,如何实现
bitmapOrg = BitmapFactory.decodeResource(getResources(),mThumbIds[GameActivity.level]);
请转发一些解决方案,紧急情况此问题,等待更多的日子,请提前感谢
解决方案
我认为您需要在对话框中设置图标。
如果是这样,您可以通过以下
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Message");
builder.setCancelable(false)
.setPositiveButton("Ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog alert = builder.create();
alert.setTitle("Title");
alert.setIcon(R.drawable.your_image);
alert.show();
谢谢
其他提示
如果要在对话框中设置图像,这是一个粗略的答案:
imageView image = new ImageView(this);
image.setlayoutparams(new LayoutParams(您的宽度,高度));
通过使用可绘制或设置位图,在此ImageView上设置背景图像
new AlertDialog()。构建器(this).setView(image).show();
这只是一个粗略的解决方案,但它会给您一个主意
不隶属于 StackOverflow