

From the Palette, drag a “Group” into the new “menu” in the Component Tree:Īndroid Studio Menu Editor, Showing New Group So, switch to the “Code” view and add an empty element as a child of the filter element:
ANDROID STUDIO ICON ON BUTTON ANDROID
Unfortunately, at this point, Android Studio bugs crop up yet again, and we cannot readily add a checkable submenu to this item via drag-and-drop. Click OK to close the dialog and complete the configuration of this app bar item:Īndroid Studio Menu Editor, Showing Configured MenuItem In the dialog, fill in menu_filter as the resource name and “Filter” as the resource value. Click on “Add new resource” > “New string Value” in the drop-down towards the top. As before, this brings up a string resource selector. Then, click the “O” button next to the “title” field. Click on ic_filter in the list of drawables, then click OK to accept that choice of icon. This will bring up an drawable resource selector. Next, click on the “O” button next to the “icon” field. Then, choose both “ifRoom” and “withText” for the “showAsAction” option.

In the Attributes view for this new item, assign it an ID of filter. Drag a “Menu Item” from the “Palette” view into the Component Tree, slotting it before the existing “add” item:Īndroid Studio Graphical Menu Editor, Showing New Item Next, open up the res/menu/actions_roster.xml resource file, and switch to the graphical designer. That is the desired icon, already set up for you.
ANDROID STUDIO ICON ON BUTTON DOWNLOAD
Instead, just close up the Vector Asset wizard, and download this file into res/drawable instead. If the icon selector did not open, that may be due to this Arctic Fox bug. Then, click “Next” and “Finish” to close up the wizard and set up our icon. There, click the “Icon” button and search for filter:Īndroid Studio Vector Asset Selector, Showing “filter” OptionsĬhoose the “filter list” icon and click “OK” to close up the icon selector. Right-click over res/drawable/ in the project tree and choose “New” > “Vector Asset” from the context menu. To do that, we will use an app bar item that has a submenu of radio buttons, so the user can toggle between the different filter modes. This time, we need to add one to allow the user to filter the list of items. We have added quite a few app bar items in these tutorials.
