Preliminary Look at View Tooltips

Exploring Android O’s View tooltips

Hidden among the API changes for Android O is a new feature for Views called tooltips. Being curious about what they look like and how they behave, I dug in to find out more.

To try out tooltips you will need the Android O SDK and either a physical device or an emulator running Android O. If you don’t have these things, check out the Android preview program website.

These tooltips will feel very familiar to anyone who has used a computer in the few decades- they are very similar to the tooltips you get on other operating systems when hovering over content.

How to use them

As with most View properties, you can set tooltip text using either an XML attribute (android:tooltipText) or using Java methods (get/setTooltipText()).

You can give any View a tooltip.

What they look like

The biggest question of course is what they look like. Here’s a basic example:

Basic tooltip for a ProgressBar

They look a lot like a toast- they have a semitransparent gray rectangular background with rounded corners. The look is the same regardless of what type of View you are using.

If your View is too far to the top of its parent layout (even if that layout is not the root of your Activity/Fragment), then the tooltip appears below the View.

This tooltip goes below the TextView because there isn’t enough room at the top

You can put multi-line text in the tooltip, and if your text goes beyond 98 characters it will be ellipsized like so:

Truncated tooltip

Also note that there is a maximum width to the tooltip, and your text will break on to multiple lines automatically to fit within those bounds.


The setTooltipText() method gives us this to describe the behavior:

The tooltip will be displayed:

* On long click, unless is not handled otherwise (by OnLongClickListener or a
context menu).
* On hover, after a brief delay since the pointer has stopped moving

This is pretty straightforward- our tooltip will show up on a long press or when the View is in the hovered state (e.g. with a mouse and keyboard configuration).

Note there’s a slight typo in the documentation here- If you have an OnLongClickListener the tooltip will display unless you handle it (i.e. return true), not “unless it is not handled.” Issue filed here.


There are currently no callbacks or overridable methods to customize the look and feel of the tooltip. There is also no documentation on whether or not they are customizable via a theme attribute, so right now the answer is “no.”


There are a few quirks with tooltips, but remember that O is still in developer preview.

The one you are most likely to come across is that it appears as though tooltips don’t properly account for the size of the status bar in calculating where to position the tooltip.

Tooltip getting cut off by the status bar

I have filed an issue here:

Update: Google says that they have fixed this internally, and it will be available in the next preview.


One of the most common questions when Android developers see a new feature such as this one is “will it be available in the support library?”

As of version 26 of the support library, the answer is “no.” I wouldn’t be surprised if a future version of the support library included some sort of shim to provide tooltips on older versions though.

Update: version 26.0.0-beta1 of the support library added TooltipCompat!

Written by

Android Engineer at Target

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store