AlertDialog
안에 이미지가있는 레이아웃을 열려고합니다. 하지만 빈 대화 상자가 나타납니다. 여기 내 코드가있다.AlertDialog가 공란으로 표시됩니다.
ImageView.axml
레이아웃 :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="350dp"
android:id="@+id/imageView"
android:src="@drawable/Apple"
android:scaleType="centerInside" />
</LinearLayout>
C# 코드 :
AlertDialog.Builder builder = new AlertDialog.Builder(this);
AlertDialog dialog = builder.Create();
LayoutInflater inflater = LayoutInflater.From(this);
View dialogLayout = inflater.Inflate(Resource.Layout.ImageView, null);
dialog.SetView(dialogLayout);
dialog.Show();
작은 이미지 파일 이름은 모두 소문자입니까? 그렇다면 "apple.png"을 "apple.png"로 바꾸고 (그에 따라 "src ="항목을 업데이트하는) 시도해보고 드로어 블 리소스 파일 이름이 소문자 여야한다는 것을 알려줍니다. 그렇지 않은 경우 문제가 발생합니다. GetIdentifier()와 같이 0을 반환합니다. 나는 그 제안으로 내 대답을 업데이트했다. –