I like the convenience of android:onClick
, which allows you to set up a click listener on a view simply by assigning a pre-defined style including:
<item name="android:onClick">myOnClickFunction</item>
If you also assign a unique android:tag
to each view, then in myOnClickFunction()
you can check the tag
and customise the click functionality accordingly (or just do the same for each view).
My question is: is there an equivalent long click property (certainly 'android:onLongClick' doesn't exist), or is it a case of assigning a long click listener to each view separately via setOnLongClickListener()
?