Jeff L.
Jeff L.

Reputation: 226

Android LongClick in a ListView of Clickable Elements

If I have a fragment containing a ListView where each row is a series of clickable elements (say, 3 buttons) filling all available space on the row, can I possibly have a long click callback for the entire row?

I want the user to be able to click on any of the three elements with a quick click but the long click should select the entire row/entry.

I have tried hooking up the ListView with the setOnItemLongClickListener while setting android:longClickable on the individual elements in the layout, but I never see the callback get hit for the long press.

Is this feasible? Do I need to have each element listen for the long click and push it back to the ListView somehow?

Upvotes: 1

Views: 428

Answers (2)

Vahe Muradyan
Vahe Muradyan

Reputation: 1115

Put longclicklistener on list view and when that is performed some boolean make true and in your 3elements clicklisteners check if it is false than do other commands.

Upvotes: 0

Sam
Sam

Reputation: 4284

Since these three elements(Button) filling up entire space of the , it is difficult to set long click listener for that row...

so good idea is set one same long click listener for these elements rather than row, if they don't have any long click events..

thank you

Upvotes: 1

Related Questions