How to set left and top magin

How to set left and top margin of button in framelayout
FrameLayout.LayoutParams layoutparam = (FrameLayout.LayoutParams)addbutton.getLayoutParams();
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(layoutparam.width, layoutparam.height);

lp.setMargins(layoutparam.leftMargin, layoutparam.topMargin, layoutparam.rightMargin, layoutparam.bottomMargin);
addbutton.setLayoutParams(lp);

Quite ago, I’ve made extension for precise setting of both margins and padding of every Visual component in MIT App Inventor 2. Here: https://github.com/Tomislav-Tomsic/GUI-Extension

Source is available, there should also be modest example(s), perhaps that can help you.

Tschuss

1 Like

Thanks sir for source code but sir I want to use for non visible component is it possible ? and in that source have visible view component