Android 渲染图像太高时出错(空白页) 问题

Android 渲染图像太高时出错(空白页) 问题,android,image,scrollview,Android,Image,Scrollview,我有一个片段,基本上有一个滚动视图,在全屏向下查看布局时显示一个图像视图。 如果为ImageView加载的图像太高,超过2000像素,则结果是图像视图将显示空白页 我可以向下滚动,就像显示图像一样 我从原始图像720x2352开始,然后我尝试切割图像的部分。在2000像素高度时,图像正确显示 手机需要使用的尺寸为720x1280 密码 布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:androi

我有一个片段,基本上有一个滚动视图,在全屏向下查看布局时显示一个图像视图。 如果为ImageView加载的图像太高,超过2000像素,则结果是图像视图将显示空白页

我可以向下滚动,就像显示图像一样

我从原始图像720x2352开始,然后我尝试切割图像的部分。在2000像素高度时,图像正确显示

手机需要使用的尺寸为720x1280

密码 布局

<?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="wrap_content"
    android:background="#FFFFFF"
    android:orientation="vertical">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"/>
    </ScrollView>

    <!-- other stuff -->
</LinearLayout>
问题
如何在不让生成的图像视图显示空白页面的情况下保留图像的高度?

您共享的像素太大,系统无法工作。您可以简单地使用图像加载和缓存库,如Glide、Picasso,它有助于调整图像大小,并保持如您所说的纵横比

您还可以将此帖子作为参考:


我想保留客户发送给我的图像,但最后我按照您的提示调整了图像的大小,并使用外部程序保留了纵横比。成功了,谢谢