Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Creating an Overflow Menu on Android

During my CodeRage 8 session I talked about creating an Action Bar with an Overflow menu, so I wanted to provide some step-by-step instructions.

On Android, an Action Bar is a top (or top and bottom aligned) toolbar that is segmented into 4 key functional areas. One of those functional areas is an Overflow menu.

The ‘Overflow’ popup menu is commonly used for additional menu items on Android and accessed via the Action Bar. An Overflow menu is designed to give the application user quick access to additional/less often used features that are otherwise not accessible via more prominent menu items.

In FireMonkey, you can easily implement an Overflow menu through the use of TListBox.

In my example, I am using the following 4 components:

ListBox Item Properties:

TSpeedButton properties:

I used a larger (80x80px) icon for each listbox item bitmap so that the icons look nice on both lower resolution and high resolution displays.

I also created the following on-click Event for my OverflowButton:

procedure TForm10.OverflowButtonClick(Sender: TObject);
begin
  OverflowMenu.Visible := not OverflowMenu.Visible;
  if OverflowMenu.Visible then
  begin
    OverflowMenu.ApplyStyleLookup;
    OverflowMenu.RealignContent;
end;
end;

  

Below is a quick recording of the Overflow menu in action.

 

 

 

Sincerely,

Sarina  

 

Exit mobile version