java - Android Adding buttons -


im trying android app gui control arduino using apwidgets library .

now have 4 buttons side side .. want add more buttons under each of them.( mean want add button under of red button , on . idont know language . can me ?

//setup gui********************************  buttonwidth=((width/n)-(n*gap));  buttonheight=(height/2);  widgetcontainer = new apwidgetcontainer(this); //create new container widgets  redbutton =new apbutton((buttonwidth*(n-4)+(gap*1)), gap, buttonwidth, buttonheight, "red"); //create red button  greenbutton = new apbutton((buttonwidth*(n-3)+(gap*2)), gap, buttonwidth, buttonheight, "green"); //create green button  bluebutton = new apbutton((buttonwidth*(n-2)+(gap*3)), gap, buttonwidth, buttonheight, "blue"); //create blue button  offbutton = new apbutton((buttonwidth*(n-1)+(gap*4)), gap, buttonwidth, buttonheight, "off"); //create off button  widgetcontainer.addwidget(redbutton); //place red button in container  widgetcontainer.addwidget(greenbutton); //place green button in container  widgetcontainer.addwidget(bluebutton);//place blue button in container  widgetcontainer.addwidget(offbutton);//place off button in container  background(0); //start black background 

it's easy , added button ,calls yenibutton . begin of code apbutton redbutton, greenbutton, bluebutton, offbutton,yenibutton;
important thing new apbutton(int x ,int y, buttons width,buttons heights,"name"); , defined new button u can see following code

buttonwidth=((width/n)-(n*gap));      buttonheight=(height/2);      widgetcontainer = new apwidgetcontainer(this); //create new container widgets      yenibutton = new apbutton(700,600,(buttonwidth/2),(buttonheight/2),"yeni buton");      redbutton =new apbutton((buttonwidth*(n-4)+(gap*1)), gap, buttonwidth, buttonheight, "red"); //create red button      greenbutton = new apbutton((buttonwidth*(n-3)+(gap*2)), gap, buttonwidth, buttonheight, "green"); //create green button      bluebutton = new apbutton((buttonwidth*(n-2)+(gap*3)), gap, buttonwidth, buttonheight, "blue"); //create blue button      offbutton = new apbutton((buttonwidth*(n-1)+(gap*4)), gap, buttonwidth, buttonheight, "off"); //create off button      widgetcontainer.addwidget(redbutton); //place red button in container      widgetcontainer.addwidget(greenbutton); //place green button in container      widgetcontainer.addwidget(bluebutton);//place blue button in container      widgetcontainer.addwidget(offbutton);//place off button in container      widgetcontainer.addwidget(yenibutton);      background(0); //start black background 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -