0
이미지가있는 AlertDialog를 표시하려고합니다. 그러나 상황에 따라 이미지가 달라질 수 있습니다. 프로그래밍 XML 내에서 이미지 뷰에 액세스 할 수있는 방법이 있나요Android - 변경 가능한 이미지가있는 경고 대화 상자
<?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>
:
이
내가에 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입니다 파일 그래서 나는 이미지를 바꿀 수 있습니까? 아니면 더 좋은 방법이 있을까요?
감사합니다! 그것은 효과가 있었다. –