Java Question Position a view in FrameLayout

XverhelstX

Well-Known Member
Licensed User
Longtime User
I'm trying to position a view in my FrameLayout, but the view gets positioned in the topleft corner with the given width and height.

B4X:
/**
 * Adds a view to the window.
 */
public void AddPanel(PanelWrapper child, int Left, int Top, int Width, int Height) {
    this.window.addView(child.getObject(), new BALayout.LayoutParams(Left, Top, Width, Height));
    child.getObject().setPadding(Left, Top, 0, 0);

    for (int i=0;i<child.getNumberOfViews();i++) {
        Log.i("B4A", "View " + i);
        ViewEventListener vel = new ViewEventListener();
        vel.Initialize(this.ba, this.eventName, child.GetView(i).getObject());
    }

    ViewEventListener vel = new ViewEventListener();
    vel.Initialize(this.ba, this.eventName, child.getObject());
}

What i'm trying to do is position the view (PanelWrapper is a viewgroup) on the given position with the given dimensions.

What am i doing wrong?
Tomas
 
Top