ツールチップ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Compose をお試しください
Jetpack Compose は、Android で推奨される UI ツールキットです。Compose でコンポーネントを追加する方法について説明します。
ツールチップとは、ユーザーがビューを長押ししたり、ビューにカーソルを合わせたりしたときに、その近くに表示される小さな説明メッセージのことです。ツールチップは、アプリでレイアウトのスペースを節約するために、操作や情報をアイコンで表示する場合に役立ちます。このページでは、Android 8.0(API レベル 26)以降でツールチップを利用する方法を説明します。
生産性向上アプリなど、シナリオによっては、意図や操作を伝えるための説明手段が必要となります。ツールチップを使用すれば、図 1 に示すように説明メッセージを表示できます。

図 1. Android アプリに表示されたツールチップ
一部の標準ウィジェットでは、title
または content description
プロパティの内容に基づいてツールチップが表示されます。Android 8.0 以降では、他のプロパティの値にかかわらず、ツールチップに表示されるテキストを指定できます。
ツールチップ テキストの設定
setTooltipText()
メソッドを呼び出すことにより、View
のツールチップ テキストを指定できます。また、対応する XML 属性または API を使用して、tooltipText
プロパティを設定できます。
XML ファイルでツールチップ テキストを指定するには、次の例に示すように android:tooltipText
属性を設定します。
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:tooltipText="Send an email" />
コード内でツールチップ テキストを指定するには、次の例に示すように setTooltipText(CharSequence)
メソッドを呼び出します。
Kotlin
val fab: FloatingActionButton = findViewById(R.id.fab)
fab.tooltipText = "Send an email"
Java
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setTooltipText("Send an email");
API に含まれている getTooltipText()
メソッドを使用すれば、tooltipText
プロパティの値を取得できます。
tooltipText
プロパティの値は、ユーザーがビューにカーソルを合わせるか、ビューを長押しすると表示されます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-08-26 UTC。
[null,null,["最終更新日 2025-08-26 UTC。"],[],[],null,["Try the Compose way \nJetpack Compose is the recommended UI toolkit for Android. Learn how to add components in Compose. \n[Tooltip →](/develop/ui/compose/components/tooltip) \n\n\u003cbr /\u003e\n\nA tooltip is a small descriptive message that appears near a view when users\nlong press the view or hover their mouse over it. This is useful when your app\nuses an icon to represent an action or piece of information to save space in the\nlayout. This page shows you how to add these tooltips on Android 8.0 (API level\n26) and higher.\n\nSome scenarios, such as those in productivity apps, require a descriptive method\nof communicating ideas and actions. You can use tooltips to display a\ndescriptive message, as shown in figure 1.\n\n**Figure 1.** Tooltip displayed in an Android app.\n\nSome standard widgets display tooltips based on the content of the `title` or\n`content description` properties. Starting in Android 8.0, you can specify the\ntext displayed in the tooltip regardless of the value of other properties.\n\nSetting the tooltip text\n\nYou can specify the tooltip text in a [View](/reference/android/view/View) by calling the\n[setTooltipText()](/reference/android/view/View#setTooltipText(java.lang.CharSequence)) method. You can set\nthe `tooltipText` property using the corresponding XML attribute or API.\n\nTo specify the tooltip text in your XML files, set the [android:tooltipText](/reference/android/R.styleable#View_tooltipText) attribute, as shown\nin the following example: \n\n \u003candroid.support.design.widget.FloatingActionButton\n android:id=\"@+id/fab\"\n android:tooltipText=\"Send an email\" /\u003e\n\nTo specify the tooltip text in your code, use the [setTooltipText(CharSequence)](/reference/android/view/View#setTooltipText(java.lang.CharSequence)) method, as shown in the following example: \n\nKotlin \n\n```kotlin\nval fab: FloatingActionButton = findViewById(R.id.fab)\nfab.tooltipText = \"Send an email\"\n```\n\nJava \n\n```java\nFloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);\nfab.setTooltipText(\"Send an email\");\n```\n\nThe API also includes a [getTooltipText()](/reference/android/view/View#getTooltipText()) method that\nyou can use to retrieve the value of the `tooltipText` property.\n\nAndroid displays the value of the `tooltipText` property when users hover their\nmouse over the view or long press the view."]]