创建了动态linearlayout。创建了两个button:
LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.HORIZONTAL); layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); TextView titleView = new TextView(this); titleView.setWidth(LayoutParams.WRAP_CONTENT); titleView.setHeight(LayoutParams.WRAP_CONTENT); titleView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); titleView.setText("Hallo Welt!"); layout.addView(titleView); Button btnConnect = new Button(this); btnConnect.setText("Connect"); layout.addView(btnConnect); Button btnDisconnect = new Button(this); btnDisconnect.setText("Disconnect"); layout.addView(btnDisconnect);
我想将链接的button放到左角,没链接的button放到右角,不知道能不能实现?
谢谢:D
阿波罗的战车
哔哔one
相关分类