3lix
3lix

Reputation: 482

Sidemenu customization

I am interested in customizing the side menu. I would like to draw a shadow over the "previous screen" that had slid right when a hamburger / side menu opens.

Is there currently a way to accomplish this?

Here is a screenshot of what I would like to accomplish: enter image description here

Upvotes: 2

Views: 299

Answers (2)

bryanb
bryanb

Reputation: 88

What would be nice if there was the equivalent of Dialog.setDefaultBlurBackgroundRadius(8); for SideMenu

Upvotes: 1

Shai Almog
Shai Almog

Reputation: 52760

You can do that pretty easily. Style the SideNavigationPanel UIID to white to create the background color, make sure it's opaque (bg transparency == 255).

You can add side commands with material icons using addMaterialCommandToSideMenu from the Toolbar class. However it will set the same color to both the icon and the text so an alternative would be to use an icon from FontImage or elsewhere.

The separator can be added like we do it in the new kitchen sink:

    Label separator = new Label(" ");
    Style separatorStyle = separator.getAllStyles();
    separatorStyle.setBgImage(Image.createImage(40, 2, 0x7f000000));
    separatorStyle.setBackgroundType(Style.BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_CENTER);
    separatorStyle.setMargin(0, 0, 0, 0);
    f.getToolbar().addComponentToSideMenu(separator);

Upvotes: 0

Related Questions