2

I'm not too sure if this has not already been answered as I feel this question is hard to pose concisely, well I found it difficult anyway.

What I want is, for example, I have an EditText, and the prompt may make sense for some people (the little hint) but I feel that for others, they may need a little more explanation/or an example.

So I would like a little round "i" button representing information next to the EditText. What I desire this button to do, is, once touched, is to kind of bring up a toast window, displaying my desired help information.

I think you can picture the functionality I'm taking about, just from user experience! But I cannot seem to find a great way of doing this, the way I'm imagining.

Now, if there is already a clear example of this somewhere that you know of, a link would be fantastic, if not, some code with some explanation would be fantastic. I am new to java and android development, but I'm getting there, slowly but surely.

Thank you very much, once again for any help, or tips!

user2864740
  • 60,010
  • 15
  • 145
  • 220
Leon92
  • 505
  • 1
  • 9
  • 15
  • Really, you needed to edit to remove me being thankful? and my greeting. Seems a little silly, just trying to get some help. – Leon92 Jul 19 '14 at 06:13

2 Answers2

2

if you just want to place a drawable you can use the use the below code.

android:drawableRight="@drawable/my_icon" />

And if you are looking for the click on the image in edittext, there are several ways:

1) there is a custom layout you can have see this for same.

2) Check for the code below by having a edittext and button in relative layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="Enter search key" />

<ImageButton
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:src="@drawable/search"
    android:layout_centerVertical="true"
    android:layout_margin="5dp"
    android:text="Button"/>

   </RelativeLayout>

3) By having a custom RElative Layout check this link

Community
  • 1
  • 1
Swati
  • 1,179
  • 9
  • 28
0

Get an image of the i that you want. Add an image view to your layout, and use that image in it. Set a onClickListener for that ImageView, and have that listener launch the toast you want to display.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127