Layout coordinator with NestedScrollView does not resize with adjustResize

I have a view that contains a CoordinatorLayout that wraps an AppBarLayout and a NestedScrollView . Inside NestedScrollView there is an EditText

I'm having trouble displaying a soft input keyboard and correctly adjusting the view size.

With the usual android:windowSoftInputMode="adjustResize" flag android:windowSoftInputMode="adjustResize" everything works fine, except when you hide the input.

When the input is open (image 2), the NestedScrollView (with a dull gray background) shrinks so you can move on to the previously β€œcovered” part. Things are good. However, after the input is hidden (image 3), NestedScrollView did not increase to fill up the space, and you can see its parent CoordinatorLayout (which I painted in red).

enter image description here enter image description here enter image description here

I tried this answer to https://stackoverflow.com/a/167188/168 by adding a myserious android:layout_gravity="fill_vertical" tag android:layout_gravity="fill_vertical" , but all this limits the height of the NestedScrollView that ends with cutting (although it fixes the problem when it refuses to fill up with its container) .

Am I missing something or is this a bug with CoordinatorLayout

Here is the layout of my XML:

 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.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/red_granate"> <android.support.design.widget.AppBarLayout android:id="@+id/actionBarContainer" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows="true"> <View android:id="@+id/statusBarPadding" android:layout_width="match_parent" android:layout_height="0dp" android:background="@color/primary_material_dark"/> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?android:attr/actionBarSize" android:background="@color/primary_material_dark" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:layout_scrollFlags="scroll|enterAlways"/> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:background="@color/grey" android:id="@+id/nestedScrollView" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <FrameLayout android:layout_width="match_parent" android:layout_height="2000dp"> <EditText android:layout_width="100dp" android:layout_height="wrap_content" android:layout_marginTop="1900dp"/> </FrameLayout> </android.support.v4.widget.NestedScrollView> </android.support.design.widget.CoordinatorLayout> 
+3
android coordinator-layout
source share
1 answer

Are you using the latest version - 22.2.1? I had similar problems with 22.2.0.

 compile 'com.android.support:design:22.2.1' compile 'com.android.support:recyclerview-v7:22.2.1' 
+4
source share

All Articles