0

In Many Android apps you can press and hold a button and a small text appears with information about the button, for example in reddit: [1]: https://i.stack.imgur.com/wdgtG.jpg

Does anyone know how to do this in Android Studio?

Joshy
  • 13
  • 1
  • You might be wondering how to use a `LongClickListener` equivalent for `Button` see here for details: https://stackoverflow.com/a/4402854/3763032. Android Studio might not have such features to magically add your `Button` unless you manually define in your XMLs – mochadwi Jul 09 '21 at 16:01

1 Answers1

1

https://developer.android.com/guide/topics/ui/tooltips

A tooltip is a small descriptive message that appears near a view when users long press the view or hover their mouse over it. This is useful when your app uses an icon to represent an action or piece of information to save space in the layout. This page shows you how to add these tooltips on Android 8.0 (API level 26) and higher.

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setTooltipText("Send an email");
Akash Pal
  • 1,055
  • 8
  • 15