Using a custom EditText that have drawable right
<com.sample.AmountEditText
android:id="@+id/search_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="@dimen/dim_16dp"
android:hint="@string/amount"
android:maxLength="12"
android:inputType="numberDecimal" />
AmountEditText.java
@Override
@SuppressLint("ClickableViewAccessibility")
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
setCursorVisibility(this.getRootView(), true);
if(!this.isEnabled()){
return false;
}
if (event.getAction() == MotionEvent.ACTION_UP && mDrawableRight != null) {
mRectBounds = mDrawableRight.getBounds();
final int x = (int) event.getX();
final int y = (int) event.getY();
if (x >= (this.getRight() - mRectBounds.width()) && x <= (this.getRight() - this.getPaddingRight()) && y >= this.getPaddingTop() && y <= (this.getHeight() - this.getPaddingBottom())) {
{
this.setText("");
}
if (this != null) {
this.setSelection(this.getText().length());
}
}
}
return super.onTouchEvent(event);
}
How can we set content description for drawable right?
Thanks in Advance