I have a class that extends from Drawable.
I draw some Views on it. I have drawable that I should set ClickListener on it!
I searched a lot, and according to this link, we have not listener for this class!
anybody can help me ?! Thanks
I have a class that extends from Drawable.
I draw some Views on it. I have drawable that I should set ClickListener on it!
I searched a lot, and according to this link, we have not listener for this class!
anybody can help me ?! Thanks
Ryan M
On
There's no way to set a click listener on a Drawable directly. You should put the Drawable into an ImageView using setImageDrawable(...).
From there, you can set a click listener on the ImageView with setOnClickListener just as you would with any other View.
Copyright © 2021 Jogjafile Inc.
According to documentation, which you've already provided,
Since the
Viewprovides a method to receive click events (setOnClickListener) and a method which sets its foreground to aDrawable(setForeground) why don't you use that?