我不知道如何將圖像放入AlertDialog。如何在AlertDialog中放置圖像? Android
我有這段代碼,但我認爲這是不可能的。
AlertDialog.Builder alert = new AlertDialog.Builder(MessageDemo.this);
ImageView imageView = (ImageView) findViewById(R.id.imageView1);
imageView.setImageResource(R.drawable.cw);
alert.setView(imageView);
alert.setNeutralButton("Here!", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int sumthin) {
}
});
alert.show();
它告訴我一個錯誤:無法執行活動的方法 – fr4n 2011-06-08 09:38:34
你嘗試我的新代碼嗎? – 2011-06-08 09:39:50
是的,你的更新。我有一個帶有圖像和按鈕的新的xml「sample.xml」。但它給了我一個錯誤。 – fr4n 2011-06-08 09:42:20