android - toggle image in imageview on double tap -
I want to toggle the image in the image view, I have tried several methods and failed ... this is the code ..
There are 2 problems .. 1) The click is defective on the list. 2) Condition if (image.isClickable ()) is always false
this code is ..
@Orderide at DoubleTap (TODO) auto-generated method stub toast. Make text (this, "double tap", toast. LNNHTARAR). Show (); Flip (); } Public Zero Flip {image.setOnClickListener} {@Override Public Zero Click on (see V) {// TODO stub automatically generated method (image.isClickable ()) image.setImageResource (R.drawable) Haimath); More image. Set Image Resource (ArduWable.LoveMath);}}); }
Now I get the following error on the click listener.
Method set onclicklist (see OnClickListener) type is not in view (New OnClickListener () {}) Is applicable to
, but when I hide it, the application runs but the condition (image.isClickable ()) will always be false ..
Try well
First of all to determine which image is
> Boolean flag = c Addiction;
Then implement onDoubleTap ()
as follows:
Override public boolean on DoubleTap (Motion Event Event) {If (flag) {Image.setImageResource (R.drawable.highmaths); Flag = false; } Other {image.setImageResource (R.drawable.lowmaths); Flag = true} back true; }
Hope this helps :)
Comments
Post a Comment