How to Creat a dynamic button ???

  • Replies:3
  • OpenNot stickiedUnanswered

May 1, 2012 12:25:55 PM via Website

Please help me !
I have a idea,
there are 2 editText (Enter weight and hight of button) and one button with name "Creat Button". When I click "Creat Button", program automatic creat a new button with weight and hight to EditText. Change value to EditText, click "CreatButton", => size of button change! Done!
Sorry, I come from VietNam, my English not good. Thanks all!

— modified on May 1, 2012 12:28:05 PM

Feb 4, 2013 1:33:32 PM via Website

Button b = new Button(Context);
b.setHeight(your height)
b.setWidth(your widthy)
yourlayout.addView(b);

that's your button created on click.

now store the value of which you want to change and apply it to height and width of button.

if you want to like as change in edittext the size will change than i think ontextchangelistener will help you

still prob let me know