使用CoordinatorLayout和Recyclerview在NestedScrollView

时间:2017-01-20 09:24:37

标签: android xml android-layout layout material-design

我到处寻找,但无法找到任何解决方案, 我有这样的布局

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:autofit="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:clickable="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:elevation="0dp">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/grey_find_breed_bg"
        app:expandedTitleMarginEnd="78dp"
        app:expandedTitleMarginStart="48dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="180dp"
            android:background="@color/white"
            android:fitsSystemWindows="true"
            app:layout_collapseMode="parallax">

            <ImageView
                android:id="@+id/image"
                android:layout_width="match_parent"
                android:layout_height="120dp"
                android:scaleType="centerCrop"
                android:src="@drawable/add_dogtopbg" />

            <RelativeLayout
                android:id="@+id/rlDog"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="@dimen/ten_dp"
                android:background="@color/white"
                android:clickable="true"
                android:padding="5dp"
                android:visibility="visible">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@color/blue_dog"
                    android:scaleType="center"
                    android:src="@drawable/add_dog"
                    android:visibility="visible"
                    app:layout_collapseMode="parallax" />

                <ImageView
                    android:id="@+id/imgDogImg"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="fitXY"
                    android:visibility="visible"
                    app:layout_collapseMode="parallax" />

                <ImageView
                    android:id="@+id/imgClose"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:src="@drawable/close_icon_add_dog"
                    android:visibility="gone" />
            </RelativeLayout>

        </RelativeLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@android:color/transparent"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.CollapsingToolbarLayout>

</android.support.design.widget.AppBarLayout>


<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="fill_vertical"
    android:background="@color/blue"
    android:fillViewport="true"
    android:foreground="@null"
    android:isScrollContainer="false"
    android:scrollbars="none"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingLeft="10dp"
        android:paddingRight="10dp">

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">

            <android.support.v7.widget.AppCompatEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/bark"
                android:drawablePadding="15dp"
                android:hint="Name"
                android:imeOptions="actionNext"
                android:singleLine="true"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black"
                android:theme="@style/Theme.App.Edittext" />

        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">

            <android.support.v7.widget.AppCompatEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/bark"
                android:drawablePadding="15dp"
                android:hint="Name"
                android:imeOptions="actionNext"
                android:singleLine="true"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black"
                android:theme="@style/Theme.App.Edittext" />

        </android.support.design.widget.TextInputLayout>

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rclBreed"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp" />


        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">

            <android.support.v7.widget.AppCompatEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/bark"
                android:drawablePadding="15dp"
                android:hint="Name"
                android:imeOptions="actionNext"
                android:singleLine="true"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black"
                android:theme="@style/Theme.App.Edittext" />

        </android.support.design.widget.TextInputLayout>


        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">

            <android.support.v7.widget.AppCompatEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/bark"
                android:drawablePadding="15dp"
                android:hint="Name"
                android:imeOptions="actionNext"
                android:singleLine="true"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/black"
                android:theme="@style/Theme.App.Edittext" />

        </android.support.design.widget.TextInputLayout>

    </LinearLayout>
</android.support.v4.widget.NestedScrollView>

如果我没有在NestedScrollView中添加recyclelerview而不是它可以,但是当我在NestedScrollView中添加了recyclelerview和edittext时,协调器布局比editttext更隐藏在键盘后面。 请帮忙

0 个答案:

没有答案