bingoogolapple / BGARefreshLayout-Android

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

Toolbar设置app:layout_scrollFlags="scroll|enterAlways"后,上拉view和加载更多的view不能显示 #15

Closed thinwonton closed 8 years ago

thinwonton commented 8 years ago

我的layout为:

<android.support.design.widget.CoordinatorLayout android:id="@+id/rootLayout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

    <android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

</android.support.design.widget.CoordinatorLayout>

在viewpager中添加fragment fragment的layout是:

<?xml version="1.0" encoding="utf-8"?> <cn.bingoogolapple.refreshlayout.BGARefreshLayout android:id="@+id/rl_recyclerview_refresh" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
    android:id="@+id/rv_recyclerview_data"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none"/>

</cn.bingoogolapple.refreshlayout.BGARefreshLayout>

refresh布局不能正常显示,refresh view和load more view

thinwonton commented 8 years ago

补充: 实验了很久,造成上面的原因是,在fragment中,把BGARefreshLayout和recyclerview的初始化放在了onViewCreated,如果把初始化放在onCreateView就没问题 奇怪的现象