I can't see you source code, so I can only guess what's happening. However, it appears that you may have kept the LayoutGroup
objects from the example, and added your views as children of those LayoutGroup
objects. I probably would have completely removed the LayoutGroup
objects from the example and replaced them with the actual views to display. For instance, you might replace the centerColumn
LayoutGroup
with your ListView
instead.
var centerColumn = new ListView();
var centerColumnLayoutData = new AnchorLayoutData();
centerColumnLayoutData.top = new Anchor(0.0, header);
centerColumnLayoutData.bottom = new Anchor(0.0, footer);
centerColumnLayoutData.right = new Anchor(0.0, rightColumn);
centerColumnLayoutData.left = new Anchor(0.0, leftColumn);
centerColumn.layoutData = centerColumnLayoutData;
addChild(centerColumn);
That being said, if you want to keep the LayoutGroup
objects, and add your views as children, that's certainly allowed. However, you will need to pass an appropriate layout to each of the LayoutGroup
objects, if you want to use layout data on their children. For instance, when you use AnchorLayoutData.center()
, the parent LayoutGroup
needs to be using AnchorLayout
, otherwise the AnchorLayoutData
will be ignored.
var footer = new LayoutGroup();
footer.layout = new AnchorLayout();
logoutButton = new Button();
logoutButton.layoutData = AnchorLayoutData.center();
footer.addChild(logoutButton);