title: ListView setOnItemClickListener not work
body: <p>Sorry for my english. I spend many times but i cant fix my problem. I have listView and i want set <code>setOnItemClickListener</code> him. This is my listView:</p>
  
  <pre><code> &lt;ListView
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:id = "@+id/listScene"
                      android:clickable="true"
                      android:cacheColorHint="#00000000"
                      android:divider="#adb8c2"
                      android:dividerHeight="1dp"
                      android:scrollingCache="false"
                      android:smoothScrollbar="true"
                      &gt;
                  &lt;/ListView&gt; 
  </code></pre>
  
  <p>Its my code </p>
  
  <pre><code> public void outputListView(ArrayList&lt;String&gt; list) {
          Adapter adapter = new Adapter(getApplicationContext(), R.layout.item, list);
          adapter.notifyDataSetChanged();
          listView.setAdapter(adapter);
  
          listView.setItemsCanFocus(false);
          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) {
                  Toast.makeText(getApplicationContext(), String.valueOf(position), Toast.LENGTH_SHORT).show();
              }
          });
      }
  </code></pre>
  
  <p>but when i click in item its nothing happens</p>
  
  <p>UPD</p>
  
  <p>My item.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      android:focusable="false"
      android:focusableInTouchMode="false"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;service.SwipeLayout
          android:layout_marginTop="5dp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;LinearLayout
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
              &lt;LinearLayout
                  android:orientation="horizontal"
                  android:background="#32777777"
                  android:layout_width="match_parent"
                  android:layout_height="70dp"&gt;
  
                  &lt;RelativeLayout
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:background="#fff"
                      android:layout_weight="0.7"
                      &gt;
  
                      &lt;TextView
                          android:id="@+id/conditions"
                          android:layout_marginTop="10dp"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:textSize="22dp"
                          android:text=""
                          android:textColor="#25ac36"
                          android:layout_centerVertical="true"
                          android:layout_centerHorizontal="true" /&gt;
  
                  &lt;/RelativeLayout&gt;
  
                  &lt;RelativeLayout
                      android:layout_weight="0.3"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"&gt;
  
                      &lt;TextView
                          android:id="@+id/description"
                          android:layout_marginLeft="10dp"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:textSize="18dp"
                          android:text=""
                          android:textColor="#222222"
                          android:layout_centerVertical="true"
                          /&gt;
                  &lt;/RelativeLayout&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;RelativeLayout
                  android:background="#66777777"
                  android:layout_width="match_parent"
                  android:layout_height="40dp"&gt;
  
                  &lt;TextView
                      android:id="@+id/rooms"
                      android:layout_marginLeft="10dp"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="18dp"
                      android:text=""
                      android:textColor="#fff"
                      android:layout_centerVertical="true"
                      /&gt;
              &lt;/RelativeLayout&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="250dp"
              android:layout_height="match_parent"&gt;
  
              &lt;RelativeLayout
                  android:id="@+id/open_b"
                  android:clickable="true"
                  android:layout_width="78dp"
                  android:layout_marginRight="5dp"
                  android:layout_marginLeft="5dp"
                  android:layout_height="match_parent"
                  android:background="#4fcc54"&gt;
  
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="18dp"
                      android:text="Open"
                      android:textColor="#fff"
                      android:id="@+id/openText"
                      android:layout_centerVertical="true"
                      android:layout_centerHorizontal="true"
                      /&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;RelativeLayout
                  android:id="@+id/disable_b"
                  android:clickable="true"
                  android:layout_width="78dp"
                  android:layout_marginRight="5dp"
                  android:layout_height="match_parent"
                  android:background="#8e8e8e"&gt;
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="18dp"
                      android:text="Disable"
                      android:textColor="#fff"
                      android:id="@+id/disableT"
                      android:layout_centerVertical="true"
                      android:layout_centerHorizontal="true"
                      /&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;RelativeLayout
                  android:id="@+id/delete_b"
                  android:clickable="true"
                  android:layout_width="78dp"
                  android:layout_height="match_parent"
                  android:background="#de5454"&gt;
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="18dp"
                      android:text="Delete"
                      android:textColor="#fff"
                      android:id="@+id/deleteText"
                      android:layout_centerVertical="true"
                      android:layout_centerHorizontal="true"
                      /&gt;
              &lt;/RelativeLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/service.SwipeLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>UPD: simple listView</strong></p>
  
  <p><strong>activity_main</strong>.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".MainActivity"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/hello_world" /&gt;
  
      &lt;ListView
          android:id="@+id/listView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:cacheColorHint="#00000000"
          android:divider="#adb8c2"
          android:dividerHeight="1dp"
          android:scrollingCache="false"
          android:smoothScrollbar="true" /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>my <strong>main</strong></p>
  
  <pre><code>  ArrayList&lt;String&gt; asd = new ArrayList&lt;&gt;();
      for(int i = 0; i &lt; 10; i++) {
          asd.add(String.valueOf(i));
      }
  
      ListView listView = (ListView) findViewById(R.id.listView);
      Adapter adapter = new Adapter(getApplicationContext(), R.layout.item, asd);
      listView.setAdapter(adapter);
  
      listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) {
              Toast.makeText(getBaseContext(), String.valueOf(position), Toast.LENGTH_LONG).show();
          }
      });
  </code></pre>
  
  <p>and <strong>item.xml</strong></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="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:text="Large Text"
          android:id="@+id/textView" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Its good, its work when i click in item listView, Toast is show position. But i need use <code>SwipeLayout</code> then i change code item.xml and add this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      android:descendantFocusability="blocksDescendants"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;com.bottom.smart.detetethis.SwipeLayout
          android:layout_marginTop="5dp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;LinearLayout
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
              &lt;LinearLayout
                  android:orientation="horizontal"
                  android:background="#32777777"
                  android:layout_width="match_parent"
                  android:layout_height="70dp"&gt;
  
                  &lt;RelativeLayout
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:background="#fff"
                      android:layout_weight="0.7"
                      &gt;
  
                      &lt;TextView
                          android:id="@+id/conditions"
                          android:layout_marginTop="10dp"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:textSize="22dp"
                          android:text="Active"
                          android:textColor="#25ac36"
                          android:layout_centerVertical="true"
                          android:layout_centerHorizontal="true" /&gt;
  
                  &lt;/RelativeLayout&gt;
  
                  &lt;RelativeLayout
                      android:layout_weight="0.3"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"&gt;
  
                      &lt;TextView
                          android:id="@+id/description"
                          android:layout_marginLeft="10dp"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:textSize="18dp"
                          android:text="Turn light on \n when people arrive"
                          android:textColor="#222222"
                          android:layout_centerVertical="true"
                          /&gt;
                  &lt;/RelativeLayout&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;RelativeLayout
                  android:background="#66777777"
                  android:layout_width="match_parent"
                  android:layout_height="40dp"&gt;
  
                  &lt;TextView
                      android:id="@+id/rooms"
                      android:layout_marginLeft="10dp"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="18dp"
                      android:text="Livingroom, Kitechen, Rest room"
                      android:textColor="#fff"
                      android:layout_centerVertical="true"
                      /&gt;
              &lt;/RelativeLayout&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="250dp"
              android:layout_height="match_parent"&gt;
  
              &lt;RelativeLayout
                  android:id="@+id/open_b"
                  android:layout_width="78dp"
                  android:layout_marginRight="5dp"
                  android:layout_marginLeft="5dp"
                  android:layout_height="match_parent"
                  android:background="#4fcc54"&gt;
  
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="18dp"
                      android:text="Open"
                      android:textColor="#fff"
                      android:id="@+id/openText"
                      android:layout_centerVertical="true"
                      android:layout_centerHorizontal="true"
                      /&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;RelativeLayout
                  android:id="@+id/disable_b"
                  android:layout_width="78dp"
                  android:layout_marginRight="5dp"
                  android:layout_height="match_parent"
                  android:background="#8e8e8e"&gt;
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="18dp"
                      android:text="Disable"
                      android:textColor="#fff"
                      android:id="@+id/disableT"
                      android:layout_centerVertical="true"
                      android:layout_centerHorizontal="true"
                      /&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;RelativeLayout
                  android:id="@+id/delete_b"
                  android:layout_width="78dp"
                  android:layout_height="match_parent"
                  android:background="#de5454"&gt;
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textSize="18dp"
                      android:text="Delete"
                      android:textColor="#fff"
                      android:id="@+id/deleteText"
                      android:layout_centerVertical="true"
                      android:layout_centerHorizontal="true"
                      /&gt;
              &lt;/RelativeLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/com.bottom.smart.detetethis.SwipeLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>got sick, its not working when i click item listView. But when I get a finger between the clearance item, its work:</p>
  
  <p><a href="https://i.stack.imgur.com/v8kIF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v8kIF.png" alt="enter image description here"></a></p>
  
  <p>to blame <code>SwipeLayout</code>, code <code>SwipeLayout</code>:</p>
  
  <pre><code>public class SwipeLayout extends LinearLayout {
  
      private ViewDragHelper viewDragHelper;
      private View contentView;
      private View actionView;
      private int dragDistance;
      private final double AUTO_OPEN_SPEED_LIMIT = 400.0;
      private int draggedX;
  
      public SwipeLayout(Context context) {
          this(context, null);
      }
  
      public SwipeLayout(Context context, AttributeSet attrs) {
          this(context, attrs, -1);
      }
  
      public SwipeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
          viewDragHelper = ViewDragHelper.create(this, new DragHelperCallback());
      }
  
      @SuppressLint("MissingSuperCall")
      @Override
      protected void onFinishInflate() {
          contentView = getChildAt(0);
          actionView = getChildAt(1);
          actionView.setVisibility(GONE);
      }
  
      @Override
      protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  
          dragDistance = actionView.getMeasuredWidth();
      }
  
      private class DragHelperCallback extends ViewDragHelper.Callback {
  
          @Override
          public boolean tryCaptureView(View view, int i) {
              return view == contentView || view == actionView;
          }
  
          @Override
          public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
              draggedX = left;
              if (changedView == contentView) {
                  actionView.offsetLeftAndRight(dx);
              } else {
                  contentView.offsetLeftAndRight(dx);
              }
              if (actionView.getVisibility() == View.GONE) {
                  actionView.setVisibility(View.VISIBLE);
              }
              invalidate();
          }
  
          @Override
          public int clampViewPositionHorizontal(View child, int left, int dx) {
              if (child == contentView) {
                  final int leftBound = getPaddingLeft();
                  final int minLeftBound = -leftBound - dragDistance;
                  final int newLeft = Math.min(Math.max(minLeftBound, left), 0);
                  return newLeft;
              } else {
                  final int minLeftBound = getPaddingLeft() + contentView.getMeasuredWidth() - dragDistance;
                  final int maxLeftBound = getPaddingLeft() + contentView.getMeasuredWidth() + getPaddingRight();
                  final int newLeft = Math.min(Math.max(left, minLeftBound), maxLeftBound);
                  return newLeft;
              }
          }
  
          @Override
          public int getViewHorizontalDragRange(View child) {
              return dragDistance;
          }
  
          @Override
          public void onViewReleased(View releasedChild, float xvel, float yvel) {
              super.onViewReleased(releasedChild, xvel, yvel);
              boolean settleToOpen = false;
              if (xvel &gt; AUTO_OPEN_SPEED_LIMIT) {
                  settleToOpen = false;
              } else if (xvel &lt; -AUTO_OPEN_SPEED_LIMIT) {
                  settleToOpen = true;
              } else if (draggedX &lt;= -dragDistance / 2) {
                  settleToOpen = true;
              } else if (draggedX &gt; -dragDistance / 2) {
                  settleToOpen = false;
              }
  
              final int settleDestX = settleToOpen ? -dragDistance : 0;
              viewDragHelper.smoothSlideViewTo(contentView, settleDestX, 0);
              ViewCompat.postInvalidateOnAnimation(SwipeLayout.this);
          }
      }
  
      @Override
      public boolean onInterceptTouchEvent(MotionEvent ev) {
          if(viewDragHelper.shouldInterceptTouchEvent(ev)) {
              return true;
          }
          return super.onInterceptTouchEvent(ev);
      }
  
      @Override
      public boolean onTouchEvent(MotionEvent event) {
          viewDragHelper.processTouchEvent(event);
          return true;
      }
  
      @Override
      public void computeScroll() {
          super.computeScroll();
          if(viewDragHelper.continueSettling(true)) {
              ViewCompat.postInvalidateOnAnimation(this);
          }
      }
  }
  </code></pre>
  
  <p>I can not delete it, because I need it in the project. I do not know how to fix this situation</p>