I have EditText
and icon inside it
<EditText
android:id="@+id/myedittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableRight="@mipmap/microphone"/>
I Set onClickListener
for the Drawable
right of an EditText
myeditText.setOnTouchListener(new View.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() >= (myeditText.getRight() - myeditText
.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
// your action here
Toast.makeText(getApplicationContext(),
"speak",Toast.LENGTH_SHORT).show();
return true;
}
}
return false;
}
});
when I click to icon right of EditText
Toast show me and work, but show me paste option on EditText
too.
how can I remove paste when icon in right clicked?