0
画像付きのAlertDialogを表示したい。しかし状況によっては画像が変わることがあります。Android - 変更可能な画像の警告ダイアログ
これは私がAlertDialogのために使っているコードです:
AlertDialog.Builder alertadd = new AlertDialog.Builder(wheel.this);
LayoutInflater factory = LayoutInflater.from(wheel.this);
final View view = factory.inflate(R.layout.alert, null);
alertadd.setView(view);
alertadd.setTitle("Alert Dialog Title");
alertadd.setNeutralButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int sumthin) {
}
});
alertadd.show();
そして、これがalert.xmlです:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/dialog_imageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image"
android:paddingLeft="5dp"
android:paddingRight="5dp"/>
</LinearLayout>
は、プログラムでXML内ImageViewのにアクセスする方法はあります私は画像を変更することができますか?それとももっと良い方法がありますか?
ありがとうございました!出来た。 –