我一直在四处寻找新材料设计的实现,向下滑动以刷新RecyclerViews,加载循环从ActionBar下来,就像新的Gmail应用程序一样。
我还没有发现类似的东西,只有一些swiperefreshlayout+recyclerview的例子。
有人知道怎么做吗?
最佳答案
您可以使用AppCombat支持库中提供的SwipetoreFresh视图:
compile 'com.android.support:appcompat-v7:21.0.0'
以下是如何将其与RecyclerView结合使用
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:clipToPadding="false"
android:layout_height="match_parent"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin" />
</android.support.v4.widget.SwipeRefreshLayout>
希望我能帮忙!