medyo / Fancybuttons

Icons, Borders, Radius ... for Android buttons
1.77k stars 397 forks source link

Issue on creating the button programatically, the button would only default to wrap content #76

Closed jojonarte closed 7 years ago

jojonarte commented 7 years ago

I'm trying to build the view programatically, The Fancybutton library can't seem to do a match_parent value to take effect on this library as it sticks to the WRAP_CONTENT value.

Code below:

ViewGroup.LayoutParams fancyButtonParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

FancyButton button = new FancyButton(context);

button.setRadius(30);
button.setLayoutParams(fancyButtonParams);
button.setText(viewObject.getString("text"));
button.setTextSize(16);

Screenshot: http://screencast.com/t/loUyOOR9ScF

medyo commented 7 years ago

Hi @jojonarte,

Could you change the order of your instructions, make sure to call button.setLayoutParams(var) at the end, because other instructions override your value and use wrap_content, this should be fixed in the coming version

Thank you

medyo commented 7 years ago

Hi @jojonarte,

Thank you for reporting the bug, it's fixed now You could try the new version

Thank you

jojonarte commented 7 years ago

Okay thanks, it worked using the method above. It really does override :O