Android 将SwipeRefreshLayout添加到具有空标题的RecyclerView
我已将headerView添加到我的RecyclerView中,如此问题的答案所述: 标题是一个空视图,将隐藏在工具栏下Android 将SwipeRefreshLayout添加到具有空标题的RecyclerView,android,android-recyclerview,swiperefreshlayout,Android,Android Recyclerview,Swiperefreshlayout,我已将headerView添加到我的RecyclerView中,如此问题的答案所述: 标题是一个空视图,将隐藏在工具栏下 <?xml version="1.0" encoding="utf-8"?> <View xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/header" android:layout_width="match_parent" and
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
问题是布局的位置。它将从工具栏下的标题开始,所以它部分隐藏在工具栏下
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="com.test.android.client.fragment.MyFragment">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" >
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout>
如何解决此问题?我发现setProgressViewOffset方法是一种解决方法 ,int,int 但我仍然不知道如何才能得到默认的开始和结束位置。将在方法中传递的参数