How to Creat a dynamic button ???

  • Replies:3
icqrx
  • Forum posts: 2

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

Reply
icqrx
  • Forum posts: 2

May 1, 2012, 12:59:06 PM via Website

help me ! Please

Reply
Jeremiah
  • Forum posts: 775

May 1, 2012, 9:40:53 PM via Website

This should not be too hard to do. What part are you having trouble with?

Reply
Ashish Tripathi
  • Forum posts: 211

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

Reply