I wanted to show information about a button on long pressing that button, like in the image shown below. I am new to android and any help would be highly appreciated .Image
Asked
Active
Viewed 566 times
0
-
1can you show your code? – Donald Wu Apr 01 '20 at 05:53
-
If you are coding in Kotlin, use this,: button.setOnLongClickListener{//write here what you want to do} – MMG Apr 01 '20 at 07:01
2 Answers
2
It's tooltipText
, just add this like below:
<Button
...
android:tooltipText="{Hint String}" />

Makoto Hata
- 281
- 1
- 8
0
If it's a button (or infact any View
), use the setOnLongClickListener
method.
button.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
// TODO Auto-generated method stub
return true;
}
});

Sparker0i
- 1,787
- 4
- 35
- 60