I know this question has been asked before, like this:
similar questions
But my issue is when I do this:
LayoutParams params = new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
);
params.setMargins(left, top, right, bottom);
It shows there's no setMargins for params. Who can help?
LayoutParams params = new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
);
params.setMargins(left, top, right, bottom);
You are missing this line i guess
button.setLayoutParams(params);
You need to use this:
LinearLayout.LayoutParams
or RelativeLayout.LayoutParams
.
You are missing setLayoutParams(params) Attribute
LayoutParams params = new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
);
params.setMargins(left, top, right, bottom);
Your_Layout.setLayoutParams(params);
I hope it will helps you .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With