til*_*lex 5 java swing android layout-manager android-linearlayout
是否有一个用于Swing的LayoutManager在Android中充当LinearLayout?我非常喜欢组件重量的概念.
您可以使用FlowLayout,GridLayout或BorderLayout.根据我在java中构建GUI的经验,我主要使用BorderLayouts(大部分时间)和GridLayouts的组合.
如果你想要它看起来像

代码是:
public void initComponents() {
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
setLayout(new java.awt.GridLayout(0, 1));
jButton1.setText("jButton1");
add(jButton1);
jButton2.setText("jButton2");
add(jButton2);
jButton3.setText("jButton3");
add(jButton3);
jButton4.setText("jButton4");
add(jButton4);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3445 次 |
| 最近记录: |