1

我想显示一个image比屏幕长的。

我正在使用ImageView内部 a scroll view。我得到一个白色的屏幕,可以滚动到 的heightimage但图像本身没有呈现

这是我正在使用的布局 xml:-

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    tools:context=".MainActivity" >


    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:contentDescription="@string/test_image_content_description"
        android:adjustViewBounds="true"
        android:visibility="visible"
        android:src="@drawable/test_image" />

</ScrollView>

test_image.png是一个文件,它在应用程序drawable的所有“ ”文件夹中都可用。

任何帮助将不胜感激!

4

3 回答 3

0

好的,我发现了问题。似乎问题在于图像的高度为 6000 像素,Android 愿意显示的最大尺寸(即使在 ScrollView 内)为 4096(即使我添加了缩放)。

调整图像大小后,它显示没有问题。

谢谢大家的回复!

于 2013-08-28T10:44:04.490 回答
0

你可以在你的 imageview 中添加一个 scaletype,比如使用android:scaleType="center"没有比例的居中图像,然后你应该android:adjustViewBounds="true"从 imageview 中删除代码。详情请参阅ImageView.ScaleType。谢谢

于 2013-08-28T08:56:23.810 回答
0

在你的ScrollView,

更改android:layout_height="wrap_content"android:layout_height="math_parent"

于 2013-08-28T08:47:53.763 回答