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>

     
     
     
     
     
  • 相关阅读:
    LNMP
    Unable to guess the mime type as no guessers are available 2 9
    django--模型字段引用
    no python application found, check your startup logs for errors
    uWSGI+django+nginx的工作原理流程与部署历程
    进程管理supervisor的简单说明
    Django 部署(Nginx)
    MyBatis学习教程
    Spring教程
    互联网的寒冬该如何度过
  • 原文地址:https://www.cnblogs.com/merryjd/p/2794905.html
Copyright © 2011-2022 走看看