title: Can't see click ripple effect in Android Touch events
body: <p>I've seen some solutions here, but none of them works for me. I am using <code>View.OnTouchListener</code> class to detect click and drag events in my app code. But that beautiful ripple effect is now gone (perhaps because I am consuming the <code>MotionEvent</code> gestures before it gets to the <code>View.OnClickListener</code>. Notice the <code>return true</code> in <code>MotionEvent.ACTION_DOWN</code> block).</p>
  
  <p>I cannot use <code>View.OnClickListener</code> to detect click events because my app uses multiple composite gestures (click, click-hold, click-hold-drag, etc). Can anyone please share some pointers on how to create ripple effect with Android touch gestures?</p>
  
  <p>Here is the code snippet for my <code>View.OnTouchListener</code> implementation inside a <code>BaseAdapter</code> class:</p>
  
  <pre><code>v.setOnTouchListener(new View.OnTouchListener() {
              @Override
              public boolean onTouch(View v, MotionEvent ev) {
                  switch (ev.getAction() &amp; MotionEvent.ACTION_MASK) {
                      case MotionEvent.ACTION_DOWN:
                          if(mAppActionDownListener != null) {
                              mAppActionDownListener.onAppActionDown(appObjectList.get(position), v);
                          }
                          Log.d("COOK", "ACTION_DOWN: " + ev.getX() + ", " + ev.getY());
                          t1 = System.currentTimeMillis();
                          return true;
  
                      case MotionEvent.ACTION_UP:
                          Log.d("COOK", "ACTION_UP: " + ev.getX() + ", " + ev.getY());
                          t2 = System.currentTimeMillis();
                          if(Math.abs(t2-t1) &lt;=300) {
                              //Toast.makeText(context, "Click event", Toast.LENGTH_SHORT).show();
                              if(mAppClickListener!=null) {
                                  mAppClickListener.onAppClicked(appObjectList.get(position), v);
                              }
                          }
  
                          return false;
  
                      case MotionEvent.ACTION_MOVE:
                          Log.d("COOK", "ACTION_MOVE: " + ev.getX() + ", " + ev.getY());
  
                          ClipData.Item item = new ClipData.Item(appObjectList.get(position).getAppname()+"~"+appObjectList.get(position).getPackagename()+"~"+appObjectList.get(position).getAppicon());
                          ClipData dragData = new ClipData(
                                  (CharSequence) v.getTag(),
                                  new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN},
                                  item);
                          v.findViewById(R.id.appicondrawable).startDrag(dragData,  // the data to be dragged
                                  new View.DragShadowBuilder(v.findViewById(R.id.appicondrawable)),  // the drag shadow builder
                                  null,      // no need to use local data
                                  0          // flags (not currently used, set to 0)
                          );
  
                          if(mAppDragListener!=null) {
                              mAppDragListener.onAppDragged(appObjectList.get(position), v);
                          }
  
                          return true;
  
                      default:
                          return false;
  
                  }
              }
          });
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>Just to clarify, setting up background/foreground/clickable attributes in the parent custom layout has no effect for reasons mentioned above. I have already tried those solutions.</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Adding the adapter item layout code.:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/applayout"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:background="?android:attr/selectableItemBackground"
      android:focusable="true"
      android:clickable="true"
      android:padding="5sp"&gt;
  
      &lt;ImageView
          android:id="@+id/appicondrawable"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:adjustViewBounds="true"
          android:maxWidth="40dp"
          android:maxHeight="40dp"
          android:scaleType="fitCenter"
          android:layout_marginStart="3dp"
          android:src="@drawable/ic_launcher_background" /&gt;
  
      &lt;TextView
          android:id="@+id/appname"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:fontFamily="sans-serif-light"
          android:gravity="center"
          android:maxLines="1"
          android:text="app name"
          android:textAlignment="center"
          android:textSize="10sp"
          android:textColor="#000000" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>