Gap between Form and container which contains label

49 views
Skip to first unread message

Karthik Marupeddi

unread,
Sep 21, 2014, 11:41:31 PM9/21/14
to codenameone...@googlegroups.com

Hi,
I am working on first mobile application with codename and my home screen has a Gap between Form and container which contains label.

I have made the margin,padding of Form and Container to zero's but still see the Gap. Can anyone please me some input on this. My homepage should finally look like below



My code:

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        Form f = new Form();
        f.setScrollable(false);
        f.setLayout(new BorderLayout());
        Container bannerContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        Label banner = new Label();
        banner.setGap(0);
        banner.setIcon(theme.getImage("Banner_Telos.png"));
        bannerContainer.addComponent(banner);
        f.addComponent(BorderLayout.NORTH, bannerContainer);

//        Container content = new Container(new GridLayout(2,2));
//        content.setScrollableY(true);
//        f.addComponent(BorderLayout.CENTER, content);

// now add stuff to content
        f.show();
    }



Thank you in advance.

Shai Almog

unread,
Sep 22, 2014, 2:17:20 AM9/22/14
to codenameone...@googlegroups.com
Hi,
the gap represents the gap between the icon and the text in the label.
Most components have a default margin and I'm assuming this is due to the banner label how do you make it blue? Did you define margin to be 0 there?
What do you have in the theme/hierarchy?
You can use the component inspector tool in the simulator to inspect the hierarchy and see exactly which component is the one that has the spacing in its coordinates.

Karthik Marupeddi

unread,
Sep 22, 2014, 11:31:19 PM9/22/14
to codenameone...@googlegroups.com
Setting the Label margin to zero did the trick...TY very much.
Reply all
Reply to author
Forward
0 new messages