如何删除scrollView顶部显示的空白区域

时间:2014-10-24 21:09:22

标签: android android-layout imageview scrollview android-linearlayout

我有以下scrollView。一切都按照我想要的方式工作,除了:在scrollView的顶部和ImageView的顶部之间有一个空白区域。我想要的是在顶部刷新图像。如果scrollView也不滚动超过图像的下边缘也会很棒。感谢所有建议。

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/welcome"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:scaleType="fitCenter"
            android:src="@drawable/welcome_page" />
    </LinearLayout>
</ScrollView>

2 个答案:

答案 0 :(得分:1)

要删除顶部空格,请尝试使用

android:scaleType="fitStart"
在ImageView中

。至于底部空间的移除,也许其他人可以帮助你。

答案 1 :(得分:0)

尝试将android:layout_marginTop="-2sp"添加到LinearLayout。这会将 LinearLayout 移动一点,隐藏空间。

相关问题