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?
views:
852answers:
3
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
2010-01-23 16:23:35
+2
A:
Do you mean something like this ?
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
2010-01-24 23:21:19
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
2010-01-24 23:30:32
Not sure about how to set the listener to handle the events only when the user touches the image (not the whole EditText)...
Guido
2010-08-30 15:34:22
+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
2010-01-24 23:33:08