NestedScrollView以横向模式隐藏底部元素

时间:2018-02-09 05:03:45

标签: android android-layout android-nestedscrollview

我在横向模式下使用NestedScrollView滚动元素。但是,底部元素正在切断。我已经尝试使用fillViewPort为true,填充底部,但没有实现任何目的。

我们如何使用包含约束布局的NestedScrollView作为其子项来进行视图滚动?



<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:fillViewport="true"
    tools:context="com.MainActivity"
    xmlns:android="http://schemas.android.com/apk/res/android"
    >


<android.support.constraint.ConstraintLayout android:layout_width="match_parent"
    android:layout_height="wrap_content"

>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/textInputLayout23"
        android:layout_width="325dp"
        android:layout_height="54dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="40dp"
        app:layout_constraintBottom_toTopOf="@+id/textInputLayout22"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.526"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0"
        app:layout_constraintVertical_chainStyle="packed">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/firstName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/hintFirstName"
            android:inputType="text" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/textInputLayout22"
        android:layout_width="325dp"
        android:layout_height="54dp"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toTopOf="@+id/textInputLayout24"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.514"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textInputLayout23">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/lastName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/hintLastName"
            android:inputType="text" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/textInputLayout24"
        android:layout_width="325dp"
        android:layout_height="54dp"
        app:layout_constraintBottom_toTopOf="@+id/textInputLayout25"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.514"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textInputLayout22">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/age"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/hintAge"
            android:inputType="numberDecimal" />
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/textInputLayout25"
        android:layout_width="325dp"
        android:layout_height="54dp"
        app:layout_constraintBottom_toTopOf="@+id/textInputLayout26"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.514"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textInputLayout24">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/hintEmail"
            android:inputType="textEmailAddress" />
    </android.support.design.widget.TextInputLayout>


    <android.support.design.widget.TextInputLayout
        android:id="@+id/textInputLayout26"
        android:layout_width="325dp"
        android:layout_height="54dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.514"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textInputLayout25">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/phone"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/hintPhone"
            android:inputType="phone" />
    </android.support.design.widget.TextInputLayout>

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="onMajorSelection"
        android:text="@string/major"
        app:layout_constraintEnd_toStartOf="@+id/majorSelected"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="@+id/textInputLayout26"
        app:layout_constraintTop_toBottomOf="@+id/textInputLayout26" />

    <TextView
        android:id="@+id/majorSelected"
        android:layout_width="200dp"
        android:layout_height="52dp"
        android:focusable="false"
        android:gravity="center_vertical"
        android:hint="@string/hintSelectedMajor"
        android:inputType="none"
        app:layout_constraintBottom_toBottomOf="@+id/button"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/button" />

    <Button
        android:id="@+id/saveButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="52dp"
        android:onClick="save"
        android:text="@string/done"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/resetButton"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="@+id/button"
        app:layout_constraintTop_toBottomOf="@+id/button"
        app:layout_constraintVertical_bias="0.057" />

    <Button
        android:id="@+id/resetButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:onClick="reset"
        android:text="@string/reset"
        app:layout_constraintBottom_toBottomOf="@+id/saveButton"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/saveButton"
        app:layout_constraintTop_toBottomOf="@+id/textInputLayout26"
        app:layout_constraintVertical_bias="1.0" />

    <Button
        android:id="@+id/removeMajor"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:background="@android:drawable/ic_delete"
        android:onClick="onDeleteMajor"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="@+id/majorSelected"
        app:layout_constraintTop_toTopOf="@+id/majorSelected" />

</android.support.constraint.ConstraintLayout>

</android.support.v4.widget.NestedScrollView>
&#13;
&#13;
&#13;

0 个答案:

没有答案