2016-10-04 12 views
1

GoogleマップビューをSwipeRefreshLayout内に配置する必要があります。問題は、SwipeRefreshLayoutがタッチイベントでGoogleマップを上書きすることです。マップをスクロールしようとすると、SwipeRefreshLayoutイベントがトリガーされています。私はGoogleマップをスクロールすると、どのように私はSwipeRefreshLayoutイベントを無効にすることができますか?GoogleMapsでのSwipeRefreshLayoutの表示

+0

あなたの現在のコードを書いてください – Stallion

答えて

0

thisでこの問題の解決策が見つかりました。Shiba J.が提案したスレッドです。SwipeRefreshLayoutを拡張し、onInterceptTouchEventをオーバーロードしました。

public class OverviewSwipeRefreshLayout extends SwipeRefreshLayout { 

    public OverviewSwipeRefreshLayout(Context context) { 
     super(context); 
    } 

    public OverviewSwipeRefreshLayout(Context context, AttributeSet attrs) { 
     super(context, attrs); 
    } 

    @Override 
    public boolean onInterceptTouchEvent(MotionEvent ev) { 
     final int action = ev.getAction(); 
     switch (action) { 
      case MotionEvent.ACTION_DOWN: 
       super.onTouchEvent(ev); 
       break; 
      case MotionEvent.ACTION_MOVE: 
       return false; 
      case MotionEvent.ACTION_CANCEL: 
       super.onTouchEvent(ev); 
       break; 
      case MotionEvent.ACTION_UP: 
       return false; 
      default: 
       break; 
     } 

     return false; 
    } 

    @Override 
    public boolean onTouchEvent(MotionEvent ev) { 
     super.onTouchEvent(ev); 
     return true; 
    } 
} 
関連する問題