0

ViewPager用のフラグメント内にRecyclerViewがあります。 RecyclerViewの各項目はLinearLayoutです。私の問題は、RecyclerViewに触れるとページをスワイプできないことです。 RelativeLayoutで試したところ、問題はLinearLayoutにありました。 ViewPager内のLinearLayoutはスワイプを無効にします

マイフラグメントレイアウト:

<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" android:layout_height="match_parent" 
    /> 

行レイアウト:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" 
    android:weightSum="1"> 
    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.05" 
     android:textAlignment="center" 
     android:id="@+id/game_all_text_number" 
     android:singleLine="true" 
     android:ellipsize="marquee" 
     android:marqueeRepeatLimit="marquee_forever" 
     /> 
    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.225" 
     android:textAlignment="center" 
     android:id="@+id/game_all_text_player1" 
     android:singleLine="true" 
     android:ellipsize="marquee" 
     android:marqueeRepeatLimit="marquee_forever" 
     /> 
    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.225" 
     android:textAlignment="center" 
     android:id="@+id/game_all_text_player2" 
     android:singleLine="true" 
     android:ellipsize="marquee" 
     android:marqueeRepeatLimit="marquee_forever" 
     /> 
    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.225" 
     android:textAlignment="center" 
     android:id="@+id/game_all_text_player3" 
     android:singleLine="true" 
     android:ellipsize="marquee" 
     android:marqueeRepeatLimit="marquee_forever" 
     /> 
    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.225" 
     android:textAlignment="center" 
     android:id="@+id/game_all_text_player4" 
     android:singleLine="true" 
     android:ellipsize="marquee" 
     android:marqueeRepeatLimit="marquee_forever" 
     /> 
    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.05" 
     android:textAlignment="center" 
     android:id="@+id/game_all_text_diff" 
     android:singleLine="true" 
     android:ellipsize="marquee" 
     android:marqueeRepeatLimit="marquee_forever" 
     /> 
</LinearLayout> 

私はRelativeLayoutに行の親を変更した場合、私はスワイプすることができ、それがうまく動作しますが、それそれがLinearLayoutの場合はありません。

RecyclerViewを一切クリックする必要はありません。RecyclerViewで行われたスワイプやタッチイベントを無効にして、フラグメントに送信する方法はありますか?

答えて

1

は、それが機能しなかった

+0

のLinearLayout RecyclerViewまたはアイテムに

android:clickable="false" android:focusable="false" android:focusableInTouchMode="false" 

を設定してみてください。私はRecyclerViewだけで設定しようとしましたが、LinearLayoutだけで、次に両方で​​何も動作しませんでしたが、私はまだページにスワイプできません。 –

関連する問題