Question

I'm trying to create a clickable TextView in a notification.
I've created a layout with some TextViews and I use a remoteView to build the notification layout.
In the notification build method I use setOnClickPendingIntent() to assign a Pending Intent to the TextView.
When I actually try to click the TextView the whole notification is 'clicked' (as there is no clickable area besides the whole notification as one block).
I've tried removing the pendingIntent of the notification itself, but yet the whole notification is clicked (just does nothing).
What should be done to make these elements be clickable ?
Are only buttons be clickable in a notification ?

Était-ce utile?

La solution

Mention android:clickable="true" for textviews in layout.

Like:

<TextView android:id="@id/tv1"
android:clickable="true"/>

By programmatically:

textview.setClickable(true);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top