Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android-ScrollView没有';不显示所有内容_Java_Android_Xml_Scrollview - Fatal编程技术网

Java Android-ScrollView没有';不显示所有内容

Java Android-ScrollView没有';不显示所有内容,java,android,xml,scrollview,Java,Android,Xml,Scrollview,我正在开发一个Android应用程序,我需要使用滚动视图。我尝试了一些方法,但滚动视图工作正常,无法显示所有内容 下面是我使用的代码片段 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/parentLayout" android:layout_width="fill_parent" android:layout_height="fi

我正在开发一个Android应用程序,我需要使用滚动视图。我尝试了一些方法,但滚动视图工作正常,无法显示所有内容

下面是我使用的代码片段

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parentLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/header"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/lower"
            android:orientation="vertical" >

            <Button
                android:id="@+id/exitButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:background="@drawable/exitselector" >
            </Button>
        </LinearLayout>

        <ScrollView
            android:id="@+id/scrollView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1" >

            <LinearLayout
                android:id="@+id/editTextContentLayout"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:gravity="center"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/ctbimLogo"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/login_logo" >
                </ImageView>

                <EditText
                    android:id="@+id/userName"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="30dp"
                    android:background="@drawable/username"
                    android:gravity="center"
                    android:hint="User name" >
                </EditText>

                <EditText
                    android:id="@+id/passWord"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="30dp"
                    android:background="@drawable/password"
                    android:gravity="center"
                    android:hint="password"
                    android:inputType="textWebPassword" >
                </EditText>

                <Button
                    android:id="@+id/loginButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="30dp"
                    android:background="@drawable/loginbuttonselector" >
                </Button>
            </LinearLayout>
        </ScrollView>
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_gravity="center"
        android:background="@drawable/lower"
        android:orientation="horizontal" >
    </LinearLayout>

</RelativeLayout>

使用下面的xml代码,它不会隐藏内容。 使用
RelativeLayout
必须指定视图的下方和上方,这样只有您才能获得完整视图而不隐藏它

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parentLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<LinearLayout
    android:id="@+id/header"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:orientation="vertical" >

    <Button
        android:id="@+id/exitButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right" >
    </Button>
</LinearLayout>

<LinearLayout
    android:id="@+id/footer"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_gravity="center"
    android:orientation="horizontal" >
</LinearLayout>

<ScrollView
    android:id="@+id/scrollView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@id/footer"
    android:layout_below="@id/header" >

    <LinearLayout
        android:id="@+id/editTextContentLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:gravity="center"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/ctbimLogo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </ImageView>

        <EditText
            android:id="@+id/userName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:gravity="center"
            android:hint="User name" >
        </EditText>

        <EditText
            android:id="@+id/passWord"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:gravity="center"
            android:hint="password"
            android:inputType="textWebPassword" >
        </EditText>

        <Button
            android:id="@+id/loginButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp" >
        </Button>
    </LinearLayout>
</ScrollView>
 </RelativeLayout>

试试这段代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/lower"
        android:orientation="vertical" >

        <Button
            android:id="@+id/exitButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:background="@drawable/exitselector" >
        </Button>
    </LinearLayout>
     <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >

    <LinearLayout
        android:id="@+id/editTextContentLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/ctbimLogo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/login_logo" />

        <EditText
            android:id="@+id/userName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:background="@drawable/username"
            android:gravity="center"
            android:hint="User name" >

            <requestFocus />
        </EditText>

        <EditText
            android:id="@+id/passWord"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:background="@drawable/password"
            android:gravity="center"
            android:hint="password"
            android:inputType="textWebPassword" />

        <Button
            android:id="@+id/loginButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:background="@drawable/loginbuttonselector" />
    </LinearLayout>


   </ScrollView>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_gravity="center"
    android:background="@drawable/lower"
    android:orientation="horizontal" >
</LinearLayout>