Reputation: 1839
In Android, when you onLongClick
an overflow menu item icon, a tooltip of its title will appear.
I've tried setting the menu title to blank, but a blank tooltip will pop up.
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_icon"
android:title="Icon Title"
android:icon="@drawable/ic_myicon"
app:showAsAction="always"/>
</menu>
Notes:
• I'm using app namespace because Android Studio is telling me to use it due to having Theme.AppCompat.Light.NoActionBar
as my theme. I've tried android namespace. Doesn't work either.
• My menu is created in a Fragment
with hasOptionsMenu(true)
.
• My ActionBar is a Toolbar
.
How can I remove this tooltip if it's possible? Thanks!
Upvotes: 2
Views: 2487
Reputation: 12379
the only way to do this is up is with android:showAsAction="withText" and set Title as =""
For onLongClickListener:
final MenuItem menuItem = menu.findItem(R.id.action_search);
searchView = (SearchView) MenuItemCompat.getActionView(menuItem);
searchView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return false;
}
});
Upvotes: 0
Reputation: 137
Yes it is possible. In the java class remove the public boolean onCreateOptionsMenu(Menu menu) and the job will be done. If no remove this also from the java class public boolean onOptionsItemSelected(MenuItem item)
Upvotes: 0