Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Actionbar items as three dots

Tags:

I have a menu for my main activity (res/menu/main_menu.xml) and I want only one item on the Actionbar and the rest shall be hidden under three dots menu. Three dots menu

The problem is, I never see the three dots item on my actionbar. Why I can't see three dots item? How to force items to be hidden under it?

Note: I use minSdkVersion="14" and I test in AVD.

like image 513
Mustafa Chelik Avatar asked Dec 23 '14 20:12

Mustafa Chelik


People also ask

How do I add three dots to my Android toolbar?

Right-click res folder and create a new Resource Directory of type menu. Right-click the menu directory and create a new resource file. From there you can drag and drop a menu item from the XML design. That should give you the 3 dots.

What is three dot menu called?

The kebab menu, also known as the three-dot menu and the vertical three-dot menu, is an icon used to open a menu with additional options. The icon is usually located at the top right or top of a screen or window.

What is an appbar in Android?

The app bar, also known as the action bar, is one of the most important design elements in your app's activities, because it provides a visual structure and interactive elements that are familiar to users.


1 Answers

<?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">      <item android:id="@+id/menu_item_share"         android:title="@string/share"         android:icon="@android:drawable/ic_menu_share"         app:showAsAction="ifRoom"         android:actionProviderClass="android.widget.ShareActionProvider" />      <item         android:id="@+id/empty"         android:title="@string/options"         android:orderInCategory="101"         app:showAsAction="always"         android:icon="@drawable/baseline_more_vert_black">          <menu>              <item android:id="@+id/action_settings"                 android:icon="@android:drawable/ic_menu_preferences"                 app:showAsAction="ifRoom"                 android:title="@string/settings" />              <item android:id="@+id/action_help"                 android:icon="@android:drawable/ic_menu_help"                 app:showAsAction="ifRoom"                 android:title="@string/help" />          </menu>      </item>  </menu> 

You will need to add the baseline_more_vert_black icons to your res/drawable... folders once you've downloaded them from here.

like image 152
ban-geoengineering Avatar answered Oct 07 '22 09:10

ban-geoengineering