title: Onfling not dispatching for TextView inside LinearLayout inside recycler view,
body: <p>So I'm making a simple to do list app on android and trying to get the hang of things.
  One thing I'm trying to get working is <code>detecting swipes</code>. Right now, I want to be able to detect a <code>swipe on a TextView</code> that is placed inside a <code>linear layout</code>. This linear layout is the view holder for one <code>RecyclingView item</code>.</p>
  
  <p>Whats confusing me is that onDown and onScroll are detected but not onFling.</p>
  
  <p>Here's my code</p>
  
  <pre><code>class ViewHolder extends RecyclerView.ViewHolder {
      public TextView toDoText;
      public Button checkButton;
  
      public ViewHolder(View itemView){
          super(itemView);
          toDoText = itemView.findViewById(R.id.toDoText);
          checkButton = itemView.findViewById(R.id.checkButton);
      }
  }
  
  
  class ToDoAdapter extends RecyclerView.Adapter&lt;ViewHolder&gt; {
  
  
      List&lt;String&gt; toDos;
      public ToDoAdapter(List&lt;String&gt; toDos){
          this.toDos = toDos;
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int id){
          Context context = parent.getContext();
          LayoutInflater inflater = LayoutInflater.from(context);
  
          View toDoView = inflater.inflate(R.layout.to_do_row, parent, false);
          ViewHolder viewHolder = new ViewHolder(toDoView);
          return viewHolder;
      }
  
  
      @SuppressLint("ClickableViewAccessibility")
      @Override
      public void onBindViewHolder(ViewHolder viewHolder, final int position){
          String toDo = toDos.get(position);
          final TextView textView = viewHolder.toDoText;
          textView.setText(toDo);
  
          textView.setOnTouchListener(new View.OnTouchListener() {
              @Override
              public boolean onTouch(View v, MotionEvent event) {
                  GestureDetector detector;
                  GestureDetector.OnGestureListener listener = new GestureDetector.OnGestureListener() {
                      @Override
                      public boolean onDown(MotionEvent e) {
                          System.out.println("DOWN");
                          return true;
                      }
  
                      @Override
                      public void onShowPress(MotionEvent e) {
                          System.out.println("SHOW PRESS");
  
                      }
  
                      @Override
                      public boolean onSingleTapUp(MotionEvent e) {
                          System.out.println("SINGLE TAP UP");
                          return true;
  
                      }
  
                      @Override
                      public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
                          System.out.println("SCROLL");
                          return true;
                      }
  
                      @Override
                      public void onLongPress(MotionEvent e) {
                          System.out.println("LONG PRESS");
  
                      }
  
                      @Override
                      public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
                          System.out.println("FLING");
                          return true;
                      }
                  };
                  detector = new GestureDetector(listener);
                  detector.setIsLongpressEnabled(false);
                  return detector.onTouchEvent(event);
              }
          });
          Button button = viewHolder.checkButton;
          button.setEnabled(true);
          button.setText("Check");
          button.setOnClickListener(new View.OnClickListener(){
              @Override
              public void onClick(View v) {
                  toDos.remove(position);
                  ToDoAdapter.this.notifyItemRemoved(position);
                  notifyItemRangeChanged(position, toDos.size());
              }
          });
      }
  
      @Override
      public int getItemCount(){
          return toDos.size();
      }
  }
  
  
  public class MainActivity extends AppCompatActivity {
      ArrayList&lt;String&gt; items;
      RecyclerView rvItems;
      EditText editText;
  
  
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          rvItems = findViewById(R.id.itemListRecycler);
          items = new ArrayList&lt;&gt;();
          items.add("Test this todo out");
          final ToDoAdapter adapter = new ToDoAdapter(items);
          rvItems.setAdapter(adapter);
          final RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
          rvItems.setLayoutManager(layoutManager);
          Button addItem = findViewById(R.id.addNewItemButton);
          editText = findViewById(R.id.newItemText);
          addItem.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  String input = editText.getText().toString();
                  if(input == null) {
                      input = "";
                  }
                  items.add(input);
                  adapter.notifyItemInserted(items.size()-1);
                  layoutManager.scrollToPosition(items.size()-1);
              }
          });
      }
  }
  </code></pre>
  
  <p>Heres my xml for the main activity</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"&gt;
  
      &lt;Button
          android:id="@+id/addNewItemButton"
          android:layout_width="wrap_content"
          android:layout_height="0dp"
          android:layout_marginTop="16dp"
          android:layout_marginEnd="16dp"
          android:layout_marginRight="16dp"
          android:layout_marginBottom="16dp"
          android:text="Add Item"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toEndOf="@+id/newItemText"
          app:layout_constraintTop_toBottomOf="@+id/itemListRecycler"
          app:layout_constraintVertical_bias="1.0" /&gt;
  
      &lt;EditText
          android:id="@+id/newItemText"
          android:layout_width="0dp"
          android:layout_height="44dp"
          android:layout_marginStart="16dp"
          android:layout_marginLeft="16dp"
          android:layout_marginEnd="16dp"
          android:layout_marginRight="16dp"
          android:layout_marginBottom="16dp"
          android:ems="10"
          android:inputType="textPersonName"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toStartOf="@+id/addNewItemButton"
          app:layout_constraintStart_toStartOf="parent" /&gt;
  
      &lt;androidx.recyclerview.widget.RecyclerView
          android:id="@+id/itemListRecycler"
          android:layout_width="0dp"
          android:layout_height="0dp"
          android:layout_marginStart="16dp"
          android:layout_marginLeft="16dp"
          android:layout_marginTop="16dp"
          android:layout_marginEnd="16dp"
          android:layout_marginRight="16dp"
          android:layout_marginBottom="16dp"
          android:scrollbars="vertical"
          app:layout_constraintBottom_toTopOf="@+id/newItemText"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.0"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintVertical_bias="0.0" /&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  
  <p>Here's my xml for the linear layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:id="@+id/toDoItemLayout"
      android:layout_height="wrap_content"
      android:paddingTop="10dp"
      android:paddingBottom="10dp"
      &gt;
  
      &lt;TextView
          android:id="@+id/toDoText"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:textSize="20dp"/&gt;
  
      &lt;Button
          android:id="@+id/checkButton"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:paddingLeft="16dp"
          android:paddingRight="16dp"
          android:textSize="10sp"
          /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>