开发者

android: how can I divide a screen exactly in two parts through XML?

开发者 https://www.devze.com 2023-01-28 02:57 出处:网络
In main.xml, I have a table layout that it has two buttons in the first row, and two EditTexts in the second row.

In main.xml, I have a table layout that it has two buttons in the first row, and two EditTexts in the second row.

when I run the application, first column 开发者_运维知识库in smaller than the other. what should I do to divide the screen equally?

Thanks


If you have a LinearLayout enclosing the TableLayout, you can set each element to have android:layout_weight="1". That way, each element (In your case each EditText or Button) would occupy the same amount of space.

0

精彩评论

暂无评论...
验证码 换一张
取 消