Skip to content Skip to sidebar Skip to footer

Android Button Tooltip

I'm new to Android and I was wondering if is possible to have an Android button element that has an embedded tooltip? I would like to have an image on the button, that when press

Solution 1:

(In response to your last comment about setting on view on top of another.)

Simple, you could use multiple LinearLayouts like this:

<LinearLayoutandroid:id="@+id/tab1"... /><TextViewandroid:text="Predefined Message"... /><ImageButton... /></LinearLayout>

Your LinearLayout (and maybe the TextView) should have one OnClickListener to do the main feature, the ImageButton will have a second OnClickListener for the tooltip.

Or you could use a RelativeLayout to position the tooltip ImageButton with an OnClickListener on top of the TextView with its own OnClickListener.

You can pass either of these custom view to an ActionBar to build the tabs for you, if you like. Hope that helps.

Addition

An (ugly!) RelativeLayout example:

<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="wrap_content"android:layout_height="wrap_content"
    ><Buttonandroid:id="@+id/button1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="A long text sample"
        /><Buttonandroid:id="@+id/button2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignRight="@+id/button1"android:layout_marginRight="10dp"android:text="i"
        /></RelativeLayout>

Post a Comment for "Android Button Tooltip"