-2

I am using this thing -

<EditText
            android:id="@+id/searchFor"
            android:layout_width="240dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="#FFFFFF"
            android:padding="5dp"
            android:hint="Search Here"
            android:drawableRight="@drawable/forward"
            android:textAppearance="?android:attr/textAppearanceSmall" />

Now as I have set the an image to this edittext how can I fire a click event on that image note it is an Edittext means I will type in my query I have tried click for edittext but then it gets fired even when I type in it

1 Answers1

2

Unfortunately there is no direct way to do this. You have to implement your onTouchListener for the EditText and if the Action event is ACTION_UP check if the x coords of the touch intersect the x coords of your drawable

Blackbelt
  • 156,034
  • 29
  • 297
  • 305