Created
June 20, 2015 10:06
-
-
Save nandha-dev/afafda18f3f7e22885af to your computer and use it in GitHub Desktop.
For drawable right on click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
editText.setOnTouchListener(new OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
final int DRAWABLE_LEFT = 0; | |
final int DRAWABLE_TOP = 1; | |
final int DRAWABLE_RIGHT = 2; | |
final int DRAWABLE_BOTTOM = 3; | |
if(event.getAction() == MotionEvent.ACTION_UP) { | |
if(event.getRawX() >= (editText.getRight() - editText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { | |
// your action here | |
return true; | |
} | |
} | |
return false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment