2

I have an Android app with a side menu. Since I am using css support, I need to style the side menu using code (what I prefer anyway).

I am facing difficulties finding the correct approach to access the side menu.

This is what I have tried:

Style sideMenuStyle =  UIManager.getInstance().getComponentStyle("SideNavigationPanel");
sideMenuStyle.setBorder(Border.createEmpty());
sideMenuStyle.setFgColor(ColorUtil.GREEN);
sideMenuStyle.setBgColor(ColorUtil.BLUE);
sideMenuStyle.setBgTransparency(200);

The side menu is in place, but my code does not have any influence on the color of the background/ foreground.

What am I missing?

rainer
  • 3,295
  • 5
  • 34
  • 50

1 Answers1

1

Why not use CSS to style the side navigation panel? That makes far more sense.

getComponentStyle returns a new Style object instance which means your changes have no impact. This is important as each component invokes that method to get its own style. If it returned the same instance changes to the style of one component would impact all components.

You can use setComponentStyle but I'd strongly recommend you don't take that route.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65