使用ScrollView滚动ImageView

Rom*_*man 1 android android-layout

我正在尝试创建一个由一个长图像组成的布局,该图像只能垂直滚动.

也就是说 - 它应该拉伸以占据整个屏幕宽度并拉伸到整个高度.

我的布局做到了这一点,但它在图像之前和之后产生了奇怪的间隙.每个间隙大约占屏幕的2/3,可以向下滚动.

如何删除间隙,以便只ImageView显示在屏幕上?

我的活动XML是这样的:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginTop="0dp" >

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="0dp"
        tools:context=".HelpActivity" >

        <ImageView
            android:id="@+id/imageHelp"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="0dp"
            android:src="@drawable/tutorial_with_text" />
    </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

Rom*_*man 7

找到解决方案:供将来参考:

在ImageView上使用android:adjustViewBounds ="true"