23

我有以下包含滚动视图的布局。屏幕尺寸大于约 4.8" 后,视图底部有一个白色区域。为什么会这样,当我将滚动视图指定为 fill_parent 时?

提前致谢。

请注意,您无法在下面的屏幕截图中看到菜单下方的空白区域,因为它是白色的,抱歉。大约有一英寸或两英寸的空间

 <?xml version="1.0" encoding="utf-8"?>


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



    <LinearLayout 
        android:id="@+id/ll1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/carefreebgscaledlighting"
        android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">




        <TextView
            android:id="@+id/textviewcompanyname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#003F87" />

        <TextView
            android:id="@+id/textViewYouAreSignedIn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_alignParentTop="true"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#003F87"
             />

              <TextView
            android:id="@+id/textViewUnsentTransactions"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_below="@id/textViewYouAreSignedIn"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#003F87"
             />

        <TextView
            android:id="@+id/spacerasnexttextviewclasheswithbg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textAppearance="?android:attr/textAppearanceLarge"
             />

        <LinearLayout

            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imagesignaltower"
                android:background="@drawable/signaltower"/>

            <ProgressBar
            android:id="@+id/progressBarSignal"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:progressDrawable="@drawable/progressbar2"
            android:layout_marginTop="10dp" />

        </LinearLayout>


        <TextView
            android:id="@+id/textview1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/stringloggedinscreen"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#003F87" />

    <Button
        android:id="@+id/buttonsignin"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/stringbuttonsignin"
         />

.........
...........
...........
</LinearLayout>
    </ScrollView>

.

在此处输入图像描述

4

3 回答 3

77

添加到您的ScrollView

android:fillViewport="true"
于 2013-10-18T08:26:18.023 回答
8

尝试设置ScrollView android:fillViewport="true",参考this

于 2013-10-18T08:27:56.383 回答
4

只需使用这个:

android:fillViewport="true"

示例滚动视图:

<ScrollView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:fillViewport="true"
                    android:fadingEdge="vertical|horizontal"
                    >

示例 NestedScrollView :

<android.support.v4.widget.NestedScrollView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:fillViewport="true"
                    android:fadingEdge="vertical|horizontal"
                    >
于 2017-01-28T20:13:22.407 回答