-5

I Want To Click on EditText DrawableRight and EditText editable is Enable. How it is Possible ? My Code is below :

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dp"
    android:orientation="horizontal">

    <EditText
        android:id="@+id/edt_profile_mobileno"
        android:layout_width="match_parent"
        android:drawableRight="@drawable/edit"
        android:layout_height="wrap_content"
        android:editable="false"
        android:hint="Mobile No"/>
</LinearLayout>

Give Me Proper Solution.Plese show this image

  • 2
    **Give Me Proper Solution.**, really? Few issues here. 1. We are not here to write code for you. 2. Your question is not clear at all. 3. You should add some code which you have tried. – Rohit5k2 Feb 17 '16 at 18:33
  • `Give Me Proper Solution` ... my solution: **Goodbye**. – Phantômaxx Feb 17 '16 at 19:19

1 Answers1

1

Just use setOnTouchListener event to your edit view. This example is taken from here

editComment.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() >= (editComment.getRight() -    editComment.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
                // your action here

             return true;
            }
        }
        return false;
    }
});
Community
  • 1
  • 1
Inducesmile
  • 2,475
  • 1
  • 17
  • 19