使用swiperefreshlayout在recyclerview的末尾放置一个按钮

时间:2017-09-30 01:34:05

标签: android-recyclerview swiperefreshlayout

我想在滚动视图的末尾放一个按钮,我知道如果我修改我的适配器我可以实现这一点,但我不想这样做,因为我认为那里'一个更简单的方法。所以我尝试修改我的布局:

<!-- Not important stuff -->

<android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/refreshIndicatorCoins"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">
        <android.support.v4.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
                <android.support.v7.widget.RecyclerView
                    android:id="@+id/rvCoinsFull"
                    android:clickable="true"
                    app:layout_behavior="@string/appbar_scrolling_view_behavior"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                </android.support.v7.widget.RecyclerView>
                <Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    />
            </LinearLayout>
        </android.support.v4.widget.NestedScrollView>
    </android.support.v4.widget.SwipeRefreshLayout>

这几乎是完美的,但是swipeRefresh的动画会冻结

1 个答案:

答案 0 :(得分:0)

希望它有所帮助。

在RecyclerView之后输入此代码。

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0">
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
    </RelativeLayout>