I searched around and didn't go out with a solution (maybe not using the right keywords).
So, I have my own ListView, which its element can be dragged when the element is long clicked. Inside this element is an ImageView and LinearLayout containing two TextViews. Actions are performed when you click on LinearLayout or ImageView.
To do this, I use setOnItemLongClickListener in my DragListView, which extends the ListView, triggers the drag and drop action and onInterceptTouchEvent to control the drag and drop action.
Then I created a custom adapter that extends the BaseAdapter and overrides its getView () to implement the children in the row. LinearLayout and ImageView were set by OnClickListener.
The problem is that LinearLayout and ImageView can perform their actions, but onItemLongClick is not called.
The listener inside getView ();
holder.delete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
For a long click element (drag initiator)
setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
int position, long id) {
}
Many thanks!
source
share