tags:

views:

852

answers:

3

I would like to have an EditText with one modification: on the right (still inside the EditText) there is an arrow pointing downwards, that I can set OnClickListener to. So when user clicks on the arrow it displays a menu. What is the best way to do this?

A: 

Sounds like a combo box. If you look at the "Building Custom Components" section of the Dev Guide, they mention combo box briefly, but give details on how to build any custom component.

RickNotFred
+2  A: 

Do you mean something like this ?

alt text

see image

Add the arrow by setting the drawable right attribute

  android:drawableRight="@drawable/right"

to your EditText. Then you would need to set an OnTouchListener to get the events.

dtmilano
I did not try this (already found a solution) but I think that click on the arrow would also open keyboard. But thanks anyway...
fhucho
Not sure about how to set the listener to handle the events only when the user touches the image (not the whole EditText)...
Guido
+1  A: 

I did this by putting EditText and a Button into RelativeLayout, the Button (which has custom background drawable) is overlapping the EditBox. When user clicks on it, the EditBox doesn't receive the click event.

fhucho