How do I set the transparency of the background,

hi, I have some problem。
1.How do I set the transparency of the background, for example, there are two container,B covers A. Can I set the background of B to be transparent? that I see the view of A。
2.How can I display Chinese in view.It show the error like this .

Thank you.

Hello @yuelan.huang,

If you want to set your container’s background transparent you need to define it in the stylesheet.
Here is our documentation about setting the style of a widget: Style — MicroEJ Documentation

  • First you will need to assign a selector to your container
  • In your stylesheet you can then get the style associated to this selector
  • You can set this style’s background transparent with the method style.setBackground(NoBackground.NO_BACKGROUND)

For your second question, can you tell me what the error is?


in the second problem,we want to show Chinese in my view .how should i do? does it microej have any method to realize it?

halo,can I ask dose it have any way to show picture,not only PNG photo。for example Android can red picture from png/wedp/xml/svg and so on.


Hello @yuelan.huang,

For your question about Chinese, you can display it if the Chinese characters are in your .ejf font.

Make sure the characters are in your font:

Then you have to embed the right characters in your application’s resources:

You should then be able to display Chinese character when using this font in your UI

Here is more documentation about fonts with MicroEJ Overview — MicroEJ Documentation.

For your question about image format, there are 2 ways to use images with MicroEJ. Images have to be converted from their original format (png, jpeg, etc) to a format that can be read by the Image Renderer (raw format). It can either be done at compile time or at run time.

At compile time, the conversion is automatically done by the Image Generator which manages a lot of format.

At runtime you will need to use the Image Loader, and, depending on the format you are using, you will need to implement an image decoder. Here is the documentation about the Image Loader

You can find more information about image format here.