zoukankan      html  css  js  c++  java
  • TableRow平均布局单元格(转载)

    android布局常常用到平均分配布局控件,比如用户登录的界面中登录与注册两个按钮,需要按1:1的比例平均分配到布局内容中,TableRow布局可以实现这样的效果。如图-1。需要设置android:layout_weight的权重。如果两个按钮均为android:layout_weight=”1″,则可以设置TableRow的比例为1:1,如果Login按钮设置android:layout_weight=”1″,Register按钮设置android:layout_weight=”2″,则Login按钮在TableRow布局中的比例为1:3,Register按钮在TableRow布局中的比例为2:3。

    xml文件如下:

    <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:padding=”12dip”>

    <TableRow android:layout_width=”fill_parent” android:layout_height=”wrap_content”> <Button android:layout_height=”fill_parent” android:layout_width=”fill_parent” android:text=”Login”  android:id=”@+id/loginBtn” android:layout_weight=”1″></Button> <Button android:layout_height=”fill_parent” android:layout_width=”fill_parent” android:text=”Register”  android:id=”@+id/registerBtn” android:layout_weight=”1″></Button> </TableRow>

    </LinearLayout>

     
     
     
     
     
  • 相关阅读:
    struts 中 s:iterator 使用注意事项
    redmine 2.5.2 安装后邮件无法发送
    yum提示another app is currently holding the yum lock;waiting for it to exit
    UVA 11809 Floating-Point Numbers
    UVA 1587 Box
    UVA 1583 Digit Generator
    UVA 340 Master-Mind Hints
    UVA 401 Palindromes
    UVA 11175 From D to E and Back
    洛谷P3916 图的遍历
  • 原文地址:https://www.cnblogs.com/merryjd/p/2794905.html
Copyright © 2011-2022 走看看