Nikhil
Nikhil

Reputation: 1309

How to build customized shaped containers?

So i am building an app with codename one

How to customize the shape of a container?

1)For example, currently a dialog box is shown in the form a rectangle. WHat if I wish to shape it as a circle/triangle/ etc?

2)Now, in codename one , there is a theme (one which has a wooden panel), so I wish to model the dialog box as a leaf. So when I say Dialog.Show(), A leaf will popup. And to this leaf,I can add whatever I want (textbox,text area etc.) . So what I will see on the screen is: a wooden panel and a dialog box in the form of leaf on top of it.

3)Now, if you have used whats app, you'll see that all the chat content is fit inside a shoutbox. how Can i do this?ie. I want a shoutbox with text in it. and the size of the shoutbox will grow dynamically to fit my text.

Upvotes: 1

Views: 703

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

All components in Codename One are square, however they can be transparent in portions thus giving you the desired effect (you obviously need to use a combination of padding/layout to fit within the drawable shape).

Just use either an image or an image border to create the look and leave the appropriate pixels transparent. Notice that quite a few of the themes (e.g. the iOS dialogs) have rounded corners which is pretty much the same thing.

Upvotes: 1

Related Questions