Android: How to do create custom EditText with a clickable arrow on the right

I would like to have an EditText with one modification: on the right but still inside the EditText there should an arrow pointing downwards that I can set OnClickListener to so that when the user clicks on the arrow it displays a menu.

What is the best way to do this?

Asked by: Sarah846 | Posted: 20-01-2022

Answer 1

Do you mean something like this ?

alt text

see image

Add the arrow by setting the drawable right attribute


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

Answered by: Emma469 | Posted: 21-02-2022

Answer 2

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.

Answered by: Brianna929 | Posted: 21-02-2022

Answer 3

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.

Answered by: Maddie241 | Posted: 21-02-2022

Similar questions

android - Clickable view / onclick: Correct approach to make View clickable?

The following code will make the View clickable, but I am wondering if this is the correct approach to make a custom view clickable? Code: public class NodePickup extends LinearLayout { public NodePickup(Context context, AttributeSet attributeSet) { super(context, attributeSet); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); ...

java - Clickable widgets in android

The developer documentation has seemed to have failed me here. I can create a static widget without thinking, I can even create a widget like the analogue clock widget that will update itself, however, I can not for the life of me figure out how to create a widget that reacts to when a user clicks on it. Here is the best code sample that the developer documentation gives to what a widget activity should contain (the only...

css - Hidden links are still clickable on the Android browser

I've got a contextual menu that appears when a button is clicked. This menu has some links and after some seconds is hidden again. The problem is that after the menu has disappeared the links are still there. They are not shown but are clickable and the green border appears. And after some seconds they disappear. I've tryied many ways of hiding the menu: display: none, visibility: hidden, width: 0, height: 0, jque...

Android - I can't make a widget clickable to launch an intent

I am new to Android development. I have developed a very simple widget that was meant to interact with the user via an ImageButton. What I am trying to do now is as follows. When a user taps the button (after adding the widget to their home screen), I want the phone to dial a certain telephone number. A sort of speed dial for your home screen. Unfortunately when I tap the button nothing happens....

Android: In Gridview how do I make the images clickable

I am trying to make the images clickable so that when they are pressed it will send the user to another page or link. How can I achive this? Currently each row in the GridView has 2 Buttons. How will it know which item in the GridView is clicked so that it performs a certain action, specific to the item that was clicked. Thanks for any help! This is in my imag...

android - Make an image clickable

I'm kind of new to this whole thing so I need some help. I have an application that creates an ImageView OnCreate. I want to make this image clickable and have it open a browser to a specific link. How would I do this? I'm having trouble specifically with the setOnClickListener because the parameters are not accepting an OnClickListener. I'm developing for Android 1.6

android - How to set a clickable region for an ImageView?

I have 2 ImageViews which have AnimationDrawable backgrounds to animate a box opening and closing when you click on it. The 2 images are slightly overlapping (the transparent area) so they can be closer together. The problem this is causing is that I am unable to click on regions of the 1st image where the 2nd image (transparent area) is overlapping. Is there a way to set a clickable region of an ImageView?...

java - Marker icon not showing up but is clickable

I've got the following code which gets information from a database and plots it on a map. The information is there and clickable but the actual icon androidmarker is not visable. Why? How do I fix this? public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tweets = new LocationData(this); mapView = (MapView) findVi...

clickable imageview location change with animation - android

I have an imageview that's included inside a RelativeLayout. When the imageview is clicked, I animate the entire RelativeLayout with a translate animation to move it down. when I click the imageview again (in it's new location) it's supposed to move it back up, but it does not. However, if I click where the imageview started, it does move the entire "panel" back up. Why is the imageview not moving with the relat...

android - GridView is not clickable

I have the following layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="" android:layout_width="fill_parent" android:layout_height="fill_parent"> <GridView android:id="@+id/grid" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" ...

Still can't find your answer? Check out these communities...

Android Google Support | Android Community | Android Community (Facebook) | Android