praew_z
praew_z

Reputation: 175

How to create context menu from the list which contain multi line

I have some question, If I create listview like this

[text]

[text]


[text]

[text]


each list contain 2 lines and I want to make context menu when I try long press to each list it will show context menu

So how to create context menu from the list which contain multi line....

Upvotes: 1

Views: 1021

Answers (1)

raukodraug
raukodraug

Reputation: 11629

Are you registering the ListView for the context menu using

registerForContextMenu(listView);

or are you creating your own context menu using listView.setOnItemLongClickListener(onItemSelctedListener())?

In both cases, there shouldn't be a problem because they act reacting to each element of the ListView

However, if you are using

listView.setOnLongClickListener(onLongClickListener)

then you are registering it to the whole list, and it doesn't matter where you press in the list, its going to bring the same context menu.

I hope that helps you with something.

Upvotes: 1

Related Questions