2

我想要在SwipeRefreshLayout中显示Google地图,以便在刷新标记时获得奇特的进度圈。我注意到你不能再向上移动地图,因为它触发了SwipeRefreshLayout。我已经尝试过使用setDistanceToTriggerSync(),并且在拉动时不再刷新,但我仍然无法移动他向上绘制的地图。我正在使用的代码:Android SwipeRefreshLayout禁用通过拉动刷新

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <android.support.v4.widget.SwipeRefreshLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:id="@+id/map_refresh"> 

    </android.support.v4.widget.SwipeRefreshLayout> 

    <fragment 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:name="com.google.android.gms.maps.SupportMapFragment" /> 

</LinearLayout> 
+0

如果你不想刷卡刷新,为什么你需要'SwipeRefreshLayout'。如果您只需刷新地图,则可以尝试使用“SyncAdapter”或“JobSchedule API”。 – bjiang

+1

我只想看看装载圈 – qwertz

回答

0

如果您需要loading circleSwipeRefreshLayout,使你映射了SwipeRefreshLayout标签内,并使用FrameLayout父视图组。

您可以尝试如下代码:

<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"> 

    <android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/map_refresh" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <fragment 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:name="com.google.android.gms.maps.SupportMapFragment" /> 

    </android.support.v4.widget.SwipeRefreshLayout> 

</FrameLayout> 
+0

我已经自己解决了,不过谢谢 – qwertz

+0

你是怎么解决的呢?我帮你还是为你敲钟? – bjiang

+0

我刚刚将SwipeRefreshLayout类复制到我的项目中,并对其进行了修改以符合我的需要 – qwertz

0

要停用手势和进步的动画,就认为 呼叫setEnabled(false)

swipeRefreshLayout.setEnabled(false);