我的 ScrollView 有问题。它里面有一个 ImageView。imageView 包含一个 480 * 3000 像素的图像。所以它需要在 ScrollView 中,这样用户才能向下滚动。
问题是:当我测试应用程序时,ScrollView 没有包装到图像高度。图像下方有一个黑色空间,这对我来说很奇怪。
这是我的 XML 代码。我期待你的意见
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/image"
android:src="@drawable/image01"
android:scaleType="fitStart" />
</ScrollView>
</RelativeLayout>
更新: 这就是我的图像使用@ruhalde 代码的样子。我不能截图,因为它很大,你不会看到整个画面,所以我画了它。