zoukankan      html  css  js  c++  java
  • layout_width="0dip"或layout_height="0dip"的情况

    Layout 中有写法如下:

         layout_height="0dip"  或者 layout_width="0dip"   

         这里的意思是不是用具体的数值来计算高度或者宽度,而是和layout_weight 一起来使用的。经常会有这样的写法: 同一个LinearLayout  (假设是横向的) 中 有几个view ,但是都不指定其具体的宽度,而是使用 layout_weight 参数来指定这几个view所占的比例。每个view所占的宽度的比例是自己的layout_weight 值和总的layout_weight的总和的比值。

    例如:

    <LinearLayoutandroid:id="@+id/remove_account_area"

           android:layout_width="match_parent"

           android:layout_height="wrap_content"

           android:orientation="horizontal"

           android:background="@android:drawable/bottom_bar">

            <View

               android:layout_width="0dip"

               android:layout_height="match_parent"

               android:layout_weight="1"/>

            <Buttonandroid:id="@+id/remove_account_button"

               android:layout_width="0dip"

               android:layout_height="wrap_content"

                android:layout_weight="2"

               android:layout_marginTop="5dip"

               android:text="@string/remove_account_label" />

            <View

                android:layout_width="0dip"

               android:layout_height="match_parent"

               android:layout_weight="1"/>

       </LinearLayout>

    这几个View宽度的的比例便是1:2:1

  • 相关阅读:
    python写入excel数据xlwt模块
    windows系统共享目录的设置
    mysql索引的建立和查询语句优化
    mysql事务的使用
    mysql读写分离-mysql-proxy的配置
    mysql主从复制配置
    linux下mysql5.7的安装配置
    Python 的介绍与发展史、解释器类型、环境安装、执行代码。
    Python 的课程介绍
    python_django_在views模块中操作状态保持(session)
  • 原文地址:https://www.cnblogs.com/liumin-txgt/p/13070484.html
Copyright © 2011-2022 走看看