In LWUIT, a white rectangular background appears when the button is pressed, how to remove it?

StackOverflow https://stackoverflow.com/questions/8702900

  •  12-04-2021
  •  | 
  •  

Question

Using LWUIT, I have a Form (form1) which contains a Button (see the silver arrow at the bottom of the Form in the left image below). This Button is constructed using an image which has a transparent background to give the effect of a non-rectangular Button. When the Button is pressed it shows another Form (form2).

But unfortunately, when the user presses this Button, a white rectangular background appears for a few milliseconds in the background of the image. see the right image below:

Before Pressing the button After Pressing the button

The question is:
How may I prevent this white rectangle from being appeared after pressing the Button ?

Was it helpful?

Solution

You have modified the state of the button when it is selected or unselected. You also have to modify pressed style. You can do it with button.getPressedStyle()

Try:

button.getPressedStyle().setBorder(null);
button.getPressedStyle().setBgTransparency(0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top