if you need to disable the touch listener on a specific line. than it is simple.
set the tag to the desired line of the list. in the list view adapter class.
eg:
ABCList extends ArrayAdapter<String> { public MyCustomAdapter(Context context, int textViewResourceId, String[] objects) { super(context, textViewResourceId, objects); } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = inflater.inflate(R.layout.history_list_item, parent, false); if(position == YOUR_DESIRED_ROW) row.setTag("disableThisRow") return row; } }
then edit the touch listener as follows.
final OnTouchListener flingSwipeListener = new OnTouchListener() { float touchX; float touchY; @Override public boolean onTouch(final View view, final MotionEvent event) { String isRow=view.getTag(); if(isRow.equals("disableThisRow"))return false; if (event.getAction() == MotionEvent.ACTION_DOWN) { touchX = event.getX(); touchY = event.getY(); } else if (event.getAction() == MotionEvent.ACTION_UP) { if (Math.abs(touchY - event.getY()) > SWIPE_MAX_OFF_PATH) return false;
this will disable touching the list item tirelessly. hope this helps. or if you are more gesture listeners than it will also be like this. hope this helps
source share