android - CollapsingToolbarLayout doesn't work well with NestedScrollView -
i made activity image should collapse toolbar , text below visible. when toolbar being collapsed, there shows large gap between toolbar , nestedscrollview
<android.support.design.widget.coordinatorlayout xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/coordinatorlayout" android:layout_width="match_parent" android:background="@color/white" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/appbarlayout" android:layout_width="match_parent" app:elevation="5dp" app:layout_collapsemode="pin" android:fitssystemwindows="true" android:layout_height="wrap_content"> <android.support.design.widget.collapsingtoolbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" app:toolbarid="@+id/toolbar" android:id="@+id/collapsing" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:layout_scrollflags="scroll|exituntilcollapsed"> <com.noframe.farmisagronom.util.resizibleimageview android:id="@+id/image_view" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollflags="scroll|enteralwayscollapsed" android:minheight="100dp" android:maxheight="400dp" android:fitssystemwindows="true" app:layout_collapsemode="parallax" app:layout_collapseparallaxmultiplier="0.5" android:scaletype="centercrop"/> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:popuptheme="@style/themeoverlay.appcompat.light" android:minheight="?attr/actionbarsize" app:layout_collapsemode="pin" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.v4.widget.nestedscrollview android:id="@+id/nesteview" app:layout_anchorgravity="top" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> ..... </android.support.v4.widget.nestedscrollview> </android.support.design.widget.coordinatorlayout> and activity looks good. 
but when scroll nestedscrollview goes out of control. 
this little space between toolbar , text getting on nerves.
note if there large text in nestedscrollview problem won't show up, if nestedscrollview + collapsed tool bar doesn't take phone screen, there gap between them.
adding:
android:layout_gravity="fill_vertical" to nestedscrollview worked me.
Comments
Post a Comment