카드에 NestedScrollView가있는 왼쪽에서 오른쪽으로 스 와이프 할 수있는 카드 시스템 (예 : Tinder)을 만들려고합니다. 목표는 사용자가 위아래 만 스 와이프하면 NestedScrollView가 스크롤되지만 사용자가 왼쪽 또는 오른쪽으로 스 와이프하면 카드가 스 와이프를 사용한다는 것입니다.Android NestedScrollView를 부모에게 가로로 스 와이프합니다.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
card_view:cardUseCompatPadding="true">
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v7.widget.CardView>
(내가 사용하고 카드 라이브러리는 https://github.com/wenchaojiang/AndroidSwipeableCardStack) 나는 NestedScrollView 그 한계 내에서 터치에 margin_top을 넣어
compile 'com.github.wenchaojiang:AndroidSwipeableCardStack:0.1.5'
에서, CardStack가 제대로 잡고 내 입력과 왼쪽 카드 이동 또는 맞습니다. 그러나 NestedScrollView는 다른 곳을 터치하고 드래그하면 방향에 관계없이 입력을 가져옵니다.
이 효과를 위해 어떤 class/onTouchEvent를 확장/재정의해야합니까? 아니면 더 간단한 방법이 있을까요?
감사합니다.
나도이 문제를 알아 내려고 생각하고 노력하고 ... 1) onInterceptTouch 부모 클래스 (기록 단계 어쩌면 및 파견?) 2) 구현 NestedChildHelper 2 라이브러리를 수정) ItemTouchHelper와 Recyclerview .. 지금까지 꽤 어려운 사람. . 문제가되는지는 확실하지 않지만, 지금까지 제가 시도하고있는 도서관은 격렬한 혼란과 swipestack입니다. https://github.com/Meetic/Shuffle 및 https://github.com/flschweiger/SwipeStack – nAndroid
라이브러리 중 하나를 사용하는 것이 recyclerview b/c보다 바람직합니다. – nAndroid
나는 onInterceptTouchEvent()가 당신이 찾고있는 메소드라고 믿는다. https://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent(android.view.MotionEvent) –