bingoogolapple / BGARefreshLayout-Android

多种下拉刷新效果、上拉加载更多、可配置自定义头部广告位
4.31k stars 1k forks source link

刷新header初始化就显示出来了,然后footer怎么也显示不出来 #77

Closed Witype closed 8 years ago

Witype commented 8 years ago

viewHolder

public class MyBGARefreshViewHolder extends BGARefreshViewHolder {

    public MyBGARefreshViewHolder(Context context, boolean isLoadingMoreEnabled) {
        super(context, isLoadingMoreEnabled);
    }

    @Override
    public View getRefreshHeaderView() {
        return View.inflate(mContext, R.layout.item_loading_footer, null);
    }

    @Override
    public void handleScale(float scale, int moveYDistance) {

    }

    @Override
    public void changeToIdle() {

    }

    @Override
    public void changeToPullDown() {

    }

    @Override
    public void changeToReleaseRefresh() {

    }

    @Override
    public void changeToRefreshing() {

    }

    @Override
    public void onEndRefreshing() {

    }
}

初始化代码

refreshLayout.setDelegate(this);
        refreshLayout.setRefreshViewHolder(new MyBGARefreshViewHolder(getApplicationContext(),true));

我在数据加载完成对时候refreshLayout.endRefreshing();也没有用, 布局代码

<?xml version="1.0" encoding="utf-8"?>
<merge android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <com.tuteng.school.custom.refreshlayout.BGARefreshLayout
        android:id="@+id/swipe_refresh_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            android:padding="@dimen/activity_horizontal_margin"/>

    </com.tuteng.school.custom.refreshlayout.BGARefreshLayout>

</merge>

刷新header和加载footer

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center">

    <ImageView
        android:layout_width="34dp"
        android:layout_height="34dp"
        android:layout_marginTop="@dimen/activity_horizontal_margin"
        android:layout_marginBottom="@dimen/activity_horizontal_margin"
        android:background="@drawable/item_loading"/>

    <TextView
        android:layout_width="34dp"
        android:layout_height="34dp"
        android:layout_marginTop="@dimen/activity_horizontal_margin"
        android:layout_marginBottom="@dimen/activity_horizontal_margin"
        android:textColor="@color/secondary_text"
        android:text="加载中..."/>
</LinearLayout>
bingoogolapple commented 8 years ago

@Witype image

去看 README 里常见问题-加载更多视图无法显示