Scroll NestedScrollView with TextInputLayout when EditText get focused
Asked Answered
O

0

8

I have that layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    android:id="@+id/coordinatorLayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/appbar_background">

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

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:titleEnabled="false">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_collapseMode="parallax"
                app:layout_collapseParallaxMultiplier="0.7">

                <android.support.v4.view.ViewPager
                    android:id="@+id/post_pager"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                />

            </RelativeLayout>

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


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


    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:background="@color/common_green"
        android:src="@drawable/add_picture"
        app:backgroundTint="@color/common_green"
        app:elevation="2dp"
        app:fabSize="normal"
        app:layout_anchor="@id/appbar"
        app:layout_anchorGravity="bottom|left|start"
        app:rippleColor="@color/common_grey"/>


    <android.support.v4.widget.NestedScrollView
        android:id="@+id/nested_scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_vertical"
        android:fitsSystemWindows="true"
        android:padding="16dp"
        app:elevation="5dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:orientation="vertical">

            <android.support.design.widget.TextInputLayout
                android:id="@+id/slide_content_til"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:background="@color/appbar_background"
                android:hint="@string/write_something"
                android:orientation="vertical"
                android:textColorHint="@color/white"
                app:errorEnabled="false"
                app:hintAnimationEnabled="false"
                app:hintTextAppearance="@style/TextAppearanceDesignHint">

                <EditText
                    android:id="@+id/slide_content_edt"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:focusable="true"
                    android:focusableInTouchMode="true"
                    android:hint="@string/write_something"
                    android:imeOptions="actionDone"
                    app:backgroundTint="@color/common_blue"
                />
            </android.support.design.widget.TextInputLayout>
        </LinearLayout>

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

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

for that activity in manifest I have android:windowSoftInputMode="stateAlwaysHidden|adjustResize"

but when I click on EditText and it get focused ( so keyboard opening) NestedScrollView does not scroll up and EditText is covered by keyboard How can I make it scroll up?

Ozonosphere answered 29/12, 2015 at 13:19 Comment(3)
Did you fix it?Arabesque
use android:fitsSystemWindows="true" for NestedScrollViewCounter
doesn't work for me :(Electrotherapy

© 2022 - 2024 — McMap. All rights reserved.