android - 添加 Scrollview 会将整个布局推到一半 View 大小?

标签 android android-layout

我有这样的布局..

<LinearLayout android:id="@+id/LinearLayout01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:background="#333333" android:orientation="vertical" android:layout_width="match_parent">
<ScrollView android:layout_width="match_parent" android:id="@+id/scrollView1" android:layout_height="match_parent">
    <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
        <FrameLayout android:layout_width="fill_parent" android:layout_height="45dip" android:id="@+id/frameLayout1">
            <EditText android:autoText="true" android:text="EditText" android:hint="@string/searchBox" android:singleLine="true" android:layout_height="fill_parent" android:id="@+id/qbox" android:layout_width="fill_parent"></EditText>
            <Button android:layout_height="fill_parent" android:text="Button" android:layout_width="45dip" android:background="@drawable/search" android:layout_gravity="right" android:id="@+id/search"></Button>
        </FrameLayout>
        <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical">
            <LinearLayout android:id="@+id/linearLayout2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center">
                <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingRight="5dip" android:id="@+id/logo" android:src="@drawable/icon" android:paddingLeft="10dip"></ImageView>

            </LinearLayout>
            <com.app.org.HorizontialListView android:layout_width="wrap_content" android:layout_height="150dip" android:id="@+id/hlist" android:background="#FFFFFF"></com.app.org.HorizontialListView>
        </LinearLayout>
        <LinearLayout android:layout_width="fill_parent" android:layout_height="40dip" android:paddingLeft="15dip" android:id="@+id/buttonlist" style="@style/tabBar"></LinearLayout>
        <ListView android:layout_width="fill_parent" android:background="#FFFFFF" android:id="@+id/searchresults" android:cacheColorHint="#ffffff" android:layout_height="match_parent" android:scrollbars="none"></ListView>
    </LinearLayout>
</ScrollView>
</LinearLayout>

我刚刚添加了 ScrollView,但出于某种原因,它似乎将我的整个布局插入了大约一半的屏幕尺寸。有人知道为什么吗?

下图说明了添加 ScrollView 对布局的影响。

Layout before ScollView
|---------------------|
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|---------------------|

Layout after ScollView
|---------------------|
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|                     |
|---------------------|

最佳答案

尝试在 ScrollView 上设置 Full Viewport = true

关于android - 添加 Scrollview 会将整个布局推到一半 View 大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5979056/

相关文章:

android - Twitter4j - 导入问题 - AndroidStudio

android - 坐标系错误,opengl es系统给android投屏

android - 默认 android 布局的可见性/可访问性

android - 在装有Android 5.x.x的每台三星设备上错误放大类ImageView

android - 无法在自定义适配器中使用 LayoutInflater

android - 如何在android中的工具栏图标中显示通知计数

java - 4.0+ 禁用主页按钮以留在当前屏幕

android - onTouch event.getX 或 Y 在不同屏幕尺寸上的一致性 - Android

android - 如何在 WhatsApp 或 Allo 等内部存储中创建文件夹?

android - 如果 actionBar/Toolbar 是白色的,菜单项上没有波纹