# TooltipCompat

Artifact: [androidx.appcompat:appcompat](https://developer.android.com/jetpack/androidx/releases/appcompat) [View Source](https://cs.android.com/search?q=file:androidx/appcompat/widget/TooltipCompat.java+class:androidx.appcompat.widget.TooltipCompat) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

*** ** * ** ***


```
class TooltipCompat
```

<br />

*** ** * ** ***

Helper class used to emulate the behavior of `https://developer.android.com/reference/android/view/View.html#setTooltipText(java.lang.CharSequence)` prior to API level 26.

## Summary

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appcompat/widget/TooltipCompat#setTooltipText(android.view.View,java.lang.CharSequence)(view: https://developer.android.com/reference/android/view/View.html, tooltipText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Sets the tooltip text for the view. |

## Public functions

### setTooltipText

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

```
java-static fun setTooltipText(view: View, tooltipText: CharSequence?): Unit
```

Sets the tooltip text for the view.

On API 26 and later, this method calls through to `https://developer.android.com/reference/android/view/View.html#setTooltipText(java.lang.CharSequence)`.

Prior to API 26, this method sets or clears (when tooltipText is `null`) the view's `OnLongClickListener` and `OnHoverListener`. A tooltip-like sub-panel will be created on long-click or mouse hover.

| Parameters |
|---|---|
| `view: https://developer.android.com/reference/android/view/View.html` | the view on which to set the tooltip text |
| `tooltipText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | the tooltip text |