Answer the question
In order to leave comments, you need to log in
Android Studio: How to force display of menu icon (three dots) in ActionBar?
As far as I understand, if the device has a "Menu" button, then the menu should be displayed by clicking on it. If there is no such button on the device, then an icon in the form of three dots appears in the ActionBar, and the menu is called when you click on this icon. At least that's how it works in my case.
What I want is that in my application (as in many others) the menu icon is displayed regardless of the presence of a button on the device.
I tried to abandon ActionBar in favor of ToolBar, but the studio starts to swear about compatibility, so I ask you not to offer work with it in advance. Changed app:showAsAction to android:showAsAction and other minor manipulations - did not help. Please help.
Menu creation code:
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.chat, menu);
return super.onCreateOptionsMenu(menu);
}
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".ChatActivity" >
<item android:id="@+id/clear_history"
android:title="@string/clear_history"
android:orderInCategory="0"
app:showAsAction="never" />
</menu>
Answer the question
In order to leave comments, you need to log in
I didn’t quite understand the question, but okay:
Let’s start with the “layout ”:
Replace it with:
If I misunderstood you or the solution did not help, please write about it.
targetSdkVersion in AndroidManifest.xml what is it?
we had this, on some devices it was always visible, even in floating form (on HTC)
I read somewhere (I don’t remember where) that the targetSdkVersion must be at least 14 for it to disappear ...
Perhaps you it is necessary on the contrary, or maybe not at all))
ZY . maybe here android-developers.blogspot.ru/2012/01/say-goodbye...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question