Despite there are some icons associated with certain action and have no enough space in the Actionbar
, they appear in the optionsMenu
instead of appearing in the overflow
icon.
I am inflating the actionBar
with five icons each one has a specific functionality "Please refer to the XML file below", the items which have the android:showAsAction=never
I expect them to implicitly reside inside the overflow
icon on the actionBar
, but when I run the App, any item with the property android:showAsAction=never
instead it appears in the optionsMenu
. Why that happens? and I hope i explained the problem clearly.
Update:
Simply, I want, if there is no space for the icon to be placed on the ActionBar
, They should be placed inside the overflow
icon as shown in the image " the icon with three vertical dots over each other".
To Note:
I am using Galaxy Note3
Why my question is marked as a duplicate. The question suggested as a duplicate is different than mine? Please review the question again.
Java_Code:
public class ActionBarActivityTest00 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_action_bar_activity_test00);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.action_bar_activity_test00, menu);
return super.onCreateOptionsMenu(menu);
}
XML:
<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="com.example.actionbaractivitytest.ActionBarActivityTest00" >
<!-- Search / will display always -->
<item android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:title="action_search"
android:showAsAction="ifRoom"/>
<!-- Location Found -->
<item android:id="@+id/action_location_found"
android:icon="@drawable/ic_action_location_found"
android:title="action_location_found"
android:showAsAction="ifRoom" />
<!-- Refresh -->
<item android:id="@+id/action_refresh"
android:icon="@drawable/ic_action_refresh"
android:title="action_refresh"
android:showAsAction="ifRoom" />
<!-- Help -->
<item android:id="@+id/action_help"
android:icon="@drawable/ic_launcher"
android:title="action_help"
android:showAsAction="never"/>
<!-- Check updates -->
<item android:id="@+id/action_check_updates"
android:icon="@drawable/ic_action_refresh"
android:title="action_check_updates"
android:showAsAction="never" />