bingoogolapple / BGARefreshLayout-Android

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

底部放置个底部导航,自定义加载在中间,显示不出来加载更多。 #60

Closed PossibleZero closed 8 years ago

PossibleZero commented 8 years ago

有什么自定义加载更多或者其他的方法吗,加载更多显示不出来。

PossibleZero commented 8 years ago

有什么方案能够解决吗,在线等,急,谢谢啦。

bingoogolapple commented 8 years ago

@PossibleZero 是在fragment中使用吗? 顺便贴一下你的布局文件来看一下

常见问题-加载更多视图无法显示

1.BGARefreshLayout的直接子控件的高度请使用android:layout_height="0dp"和android:layout_weight="1"

<cn.bingoogolapple.refreshlayout.BGARefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rl_modulename_refresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- BGARefreshLayout的直接子控件 -->
    <AnyView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />
</cn.bingoogolapple.refreshlayout.BGARefreshLayout>

2.如果是在Fragment中使用BGARefreshLayout

请在onCreateView方法中初始化BGARefreshLayout,不要在onActivityCreated方法中初始化
PossibleZero commented 8 years ago

找了下原因,不知道是不是跟这个有关,我的baseFragment是这样定义的, `<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fl_container" android:layout_width="match_parent" android:layout_height="match_parent">

<include
    android:id="@+id/loading"
    layout="@layout/common_loading_gif"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone" />

<include
    android:id="@+id/net_error"
    layout="@layout/weak_network_interface"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone" />

`

PossibleZero commented 8 years ago

我试了下找到问题的原因了,跟我写的BaseFragment有关,我基类为了处理loading,和网络异常的处理逻辑,只是我不太明白,为啥这样的原因; onCreateView的时候加载了自己定义的布局,我是将布局add进去的。 FrameLayout containerView = (FrameLayout) inflate.findViewById(R.id.fl_container); int contentId = getContentLayoutId(); if (contentId > 0) { mContentView = LayoutInflater.from(getActivity()).inflate(contentId, null); containerView.addView(mContentView, 0); 现在造成的影响是,上拉加载能显示出来,下拉加载显示不出来,并且上部滑动到上面以后,就再也滑动不下来了。 我将布局直接加载进去,就没有问题,add到跟布局的view中,就会出现上述问题。