【问题标题】:Swipe down to refresh Material Design向下滑动以刷新 Material Design
【发布时间】:2015-01-04 07:43:43
【问题描述】:

我一直在寻找新材料设计的实现,向下滑动以在 RecyclerViews 上刷新,加载圈从 ActionBar 向下,就像新的 Gmail 应用程序一样。 我还没有找到类似的东西,只有一些 SwipeRefreshLayout+RecyclerView 的例子。 有谁知道怎么做?

【问题讨论】:

    标签: android android-5.0-lollipop material-design pull-to-refresh android-recyclerview


    【解决方案1】:

    您可以使用 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>
    

    希望我能帮上忙!

    【讨论】:

    • 很有道理。谢谢,我会试试这个。
    • 我们可以在像 2.3 这样的旧版本中使用吗??
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-05
    • 2021-04-18
    • 1970-01-01
    • 1970-01-01
    • 2021-05-04
    • 2020-04-13
    • 2021-04-19
    相关资源
    最近更新 更多