When an action item is long-clicked, a Toast without text is show below the action item.
Can I disable the Toast
?
Thanks you.
Asked
Active
Viewed 2,343 times
8

Alex Lockwood
- 83,063
- 39
- 206
- 250

Wayne
- 6,361
- 10
- 46
- 69
2 Answers
4
If you omit a title or specify that the action item should be displayed with text then long-pressing will not toast. Otherwise the toast adds clarification of what each action item represents.

Jake Wharton
- 75,598
- 23
- 223
- 230
-
2how do you omit the title? `.setTitle(null)` or `.setTitle("")` doesn't work.. how do I "specify that the action item should be displayed with text then long-pressing"? – noloman Jul 09 '12 at 13:35
-
2This is not working for me too... I have not specified a title in the menu XML file but I still see a (empty) toast when long-pressing an item. – rfgamaral Aug 22 '12 at 23:38
-
1i guess the answer is accepted for that each item will toast. @Jake is there a way we can omit the title? – Jayshil Dave Feb 05 '13 at 09:48
-
2This does not work anymore. On KitKat I still get a toast but empty. – Pepijn Sep 16 '14 at 08:33
0
Using this answer to get the action bar view: https://stackoverflow.com/a/21125631/555914 I used this to disable the toast:
View actionBar = AppUtils.getActionBarView(getActivity());
if(actionBar!=null) {
View item = actionBar.findViewById(id);
if(item!=null) {
item.setOnLongClickListener(null);
}
}
Although I do not recommend disabling this functionality but sometimes designers want something for esthetic reasons...