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>

     
     
     
     
     
  • 相关阅读:
    傻帽
    csc编译c#文件
    真空
    继承,多态及抽象性
    HASH算法
    正则表达式
    js向数组和map添加元素
    详解TypeScript项目中的tsconfig.json配置
    TS:元素隐式具有 “any“ 类型,因为类型为 “any“ 的表达式不能用于索引类型
    yarn基本命令
  • 原文地址:https://www.cnblogs.com/merryjd/p/2794905.html
Copyright © 2011-2022 走看看