I am trying to implement pull to update, but I have a problem with SwipeRefreshLayout without wrapping the height of the view of the child. In view view and in live assembly, it has 0 height.
The scheme is as follows:
<android.support.design.widget.AppBarLayout android:id="@+id/app_bar" android:layout_width="match_parent" android:layout_height="wrap_content" app:elevation="0dp"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" app:layout_collapseMode="pin"> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_refresh_layout" android:layout_width="match_parent" android:layout_height="wrap_content"> <include layout="@layout/child_layout" /> </android.support.v4.widget.SwipeRefreshLayout> </android.support.v7.widget.Toolbar> </android.support.design.widget.AppBarLayout>
I also tried making SwipeRefreshLayout parent element of AppBarLayout without any success, and also putting a single LinearLayout inside the SwipeRefreshLayout . The only thing that prevents the height of the wire layout from being 0 is to set it statically, but I want it to be dynamic, based on the height of the child view.
Is there something I am missing here? It looks like there might be a bug with SwipeRefreshLayout , because replacing it with LinearLayout , which also wraps the contents, works as expected.
android android-layout swiperefreshlayout android-appbarlayout
Jake_
source share