android - CoordinatorLayout/AppBarLayout ExpandableListView being rendered off screen -


yet more problem in using coordinatorlayout , appbarlayout.

i'm trying achieve basic functionality of having toolbar scroll off screen when scrolling down , coming on screen when scrolling up.

however, current set showing problem: not toolbar not scrolling off, listview seems rendering off screen @ bottom. it's if it's been offset appbarlayout height.

here gif describing issue, note final item cut off scrollbar off screen:

enter image description here

my layout pretty standard:

<?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/background">      <android.support.design.widget.appbarlayout         android:layout_width="match_parent"         android:layout_height="wrap_content">          <android.support.v7.widget.toolbar             android:id="@+id/toolbar"             android:layout_width="match_parent"             android:layout_height="?android:attr/actionbarsize"             android:theme="@style/themeoverlay.appcompat.dark.actionbar"             android:background="@color/orange"             app:layout_scrollflags="scroll|enteralways"/>      </android.support.design.widget.appbarlayout>       <android.support.v4.widget.swiperefreshlayout         android:id="@+id/swipetorefresh"         android:layout_width="match_parent"         android:layout_height="match_parent"         app:layout_behavior="@string/appbar_scrolling_view_behavior">          <expandablelistview             android:id="@+id/listview"             android:groupindicator="@android:color/transparent"             android:layout_width="match_parent"             android:dividerheight="0px"             android:layout_height="match_parent"/>     </android.support.v4.widget.swiperefreshlayout>  </android.support.design.widget.coordinatorlayout> 

coordinatorlayout works recyclerview or nestedscrollview.try wrapping exapandablelistview inside nestedscrollview or use below code make nestedscrollingenable expandablelistview.

if (build.version.sdk_int >= build.version_codes.lollipop) {      expandablelistview.setnestedscrollingenabled(true); }else {      coordinatorlayout.layoutparams params = (coordinatorlayout.layoutparams) mswipelayout.getlayoutparams();      params.bottommargin = heightofappbarcompat;      mswipelayout.setlayoutparams(params); } 

edit can make scrolling work expected pre-21 else statement.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -