在我的AlertDialog中,我有一个ImageView,当我选择显示android:src="@drawable/logo_small"
(每个文件夹/ hdpi / ldpi等..约64x64px的png)时,一切正常。相反,当我显示时android:src="@drawable/logo_big"
(可绘制的根文件夹中只有png的1417x1417pixel和593KB),图像不会出现。
布局:
<?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"
android:gravity="center"
android:orientation="vertical"
>
<ImageView
android:id="@+id/imageLogoBig"
android:layout_width="30dp"
android:layout_height="30dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/logo_big" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="@drawable/gplay_logo" />
</LinearLayout>
imageLogoBig不在上例和下例中显示:
<ImageView
android:id="@+id/imageLogoBig"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/logo_big" />
我在写问题时才发现,如果我从drawable根目录中删除了图像logo_big,并且如果将其复制到drawable-hdpi,drawable-ldpi,drawable-mdpi和drawable-xhdpi中,则一切正常。这很奇怪,因为另一个图像imageView1仅位于drawable文件夹中(但为172x60px),并且显示正确。
为什么会这样呢?有什么建议吗?(例如,仅将logo_big放入drawable-xhdpi中。)
我解决了将logo_big
png图片仅移动到目录的问题drawable-xhdpi
,虽然不知道为什么,但是现在可以使用了。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句