2015-12-02 67 views
0

当我遇到swiperefresh图标停止并且动画也不会刷新的问题时,我正在实施swiperefreshlayout对我的项目。它只是呆在那里,没有任何反应。我想这是一个问题的布局,这是我目前的布局XML:Android SwipeRefreshLayout停止滑动而不是动画

主要活动:

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

    <com.myapp.customviews.CustomViewPager 
     android:id="@+id/pager" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/colors" 
     android:layout_below="@+id/tabs" 
     tools:context=".MainActivity" 
     android:layout_gravity="right|top" /> 

    <include android:id="@+id/toolbar" layout="@layout/toolbar" /> 

    <com.astuetz.PagerSlidingTabStrip 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="48dp" 
     android:background="@color/blue" 
     android:layout_marginTop="?attr/actionBarSize" 
     android:layout_gravity="right|top" /> 


</FrameLayout> 

所以我的主要活动包括与自定义视图寻呼机可以直接切换分页启用的帧结构的并禁用。一个工具栏和一个标签条。工具栏将隐藏在其上使用该布局的recyclerview的滚动:

<?xml version="1.0" encoding="utf-8"?> 

    <android.support.v4.widget.SwipeRefreshLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/header" 
     android:id="@+id/swipe_home"> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recyclerView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:paddingTop="?attr/actionBarSize" 
      android:clipToPadding="false"/> 
    </android.support.v4.widget.SwipeRefreshLayout> 

现在是在其中添加到主活动的视图寻呼机的片段被用于这种布局。我只是为我的recyclerview设置填充以确保项目内容正确显示,但是当我拉动刷新它时,四舍五入的刷新图标swiperefreshlayout刚好停止并出现问题。我以前在swiperefresh布局上工作过,但这是我第一次遇到这个问题。希望有人能指出问题出在哪里。

UPDATE:

我试图改变刷卡的内容从RecyclerView刷新到滚动型和拉刷新精品工程!但滚动视图不是我所需要的,所以我需要推动RecyclerView,它仍然无法正常工作并冻结。我认为RecyclerView和SwipeRefreshLayout实现有问题。

+0

你可以显示你的SwipeRefreshLayout的java代码吗? –

+0

我目前还没有在SwipeRefreshLayout上实现代码,至于recyclerview,我只是使用测试数据为列表添加项目而没有其他项目。它适用于其他可滚动视图,但不适用于recyclerview。奇怪的是,我以前试过,它工作正常,但现在我只是冻结。我今天会检查我的图书馆可能存在冲突 – KaHeL

+0

检查此[链接](http://androhub.com/android-swiperefresh-layout/)以获取swiperefresh布局示例。 –

回答

0

从22.2.0更新到23.1.1后,我使用的支持库出现问题,然后将compileSdkVersion更改为23,并将gradle更新为1.3.0以支持useLibrary 'org.apache.http.legacy'现在问题已修复,刷新刷新按预期工作。