0
即时通讯尝试使用GUI来执行Android应用程序,以使用apwidgets库控制arduino。Android添加按钮
现在我有4个按钮并排..但我想在每个按钮下添加更多的按钮(我的意思是我想添加按钮的红色按钮等,但idont知道这种语言。帮帮我吗?
//Setup GUI********************************
buttonWidth=((width/n)-(n*gap));
buttonHeight=(height/2);
widgetContainer = new APWidgetContainer(this); //create new container for widgets
redButton =new APButton((buttonWidth*(n-4)+(gap*1)), gap, buttonWidth, buttonHeight, "RED"); //Create a RED button
greenButton = new APButton((buttonWidth*(n-3)+(gap*2)), gap, buttonWidth, buttonHeight, "GREEN"); //Create a GREEN button
blueButton = new APButton((buttonWidth*(n-2)+(gap*3)), gap, buttonWidth, buttonHeight, "BLUE"); //Create a BLUE button
offButton = new APButton((buttonWidth*(n-1)+(gap*4)), gap, buttonWidth, buttonHeight, "OFF"); //Create a 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 with a black background
我强烈建议您使用XML来声明所有布局(查看内容)。 [声明布局](http://developer.android.com/guide/topics/ui/declaring-layout.html) – FMontano
谢谢你的回复,但我使用处理ide,我做按钮使用apwidgets库。你认为,XML适用于处理android ide。 ? – Burak
我从来没有用过它:/对不起,我不能有任何帮助。 – FMontano