Specifying constraints in a table layout isn't working

72 views
Skip to first unread message

Dan

unread,
Nov 15, 2013, 1:33:59 PM11/15/13
to codenameone...@googlegroups.com

A simple TableLayout form isn't working for me. As soon as I add constraints, the label isn't displayed.

public class GameSummaryTab extends Form {

    private Game game;
   
    public GameSummaryTab(Game game){
        this.game = game;
        init();
    }
   
    private void init(){
     
        Label gameDate = new Label(game.getGameDateString());

        TableLayout t = new TableLayout(10,2);
        t.setGrowHorizontally(true);
        setLayout(t);
       
        TableLayout.Constraint spanEntireRow = new TableLayout.Constraint();
        spanEntireRow.setHorizontalSpan(2);
        spanEntireRow.setHorizontalAlign(CENTER);
       
        //Date
        addComponent(gameDate);//works
        addComponent(spanEntireRow, gameDate);//doesn't work
    }
}

Shai Almog

unread,
Nov 15, 2013, 4:18:06 PM11/15/13
to codenameone...@googlegroups.com
Thanks, can you file an issue on that.
I think its related to the grow horizontally option, as a workaround you can use a constraint of width = -2 on the second column when adding the 3rd element (which should be placed in the second column).

Dan

unread,
Nov 15, 2013, 7:03:25 PM11/15/13
to codenameone...@googlegroups.com
Done and thanks.
Reply all
Reply to author
Forward
0 new messages