zoukankan      html  css  js  c++  java
  • Layout_weight

    首先按照控件的的尺寸进行分配,然后剩下的空间在按照weight的比例进行分配

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/LinearLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="111111111111111" 
            android:layout_weight="1"
            android:background="#ff3311"/>
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="2" 
            android:layout_weight="2"
            android:background="#2255dd"/>
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="3" 
            android:layout_weight="3"
            android:background="#ff6611"/>
    
    </LinearLayout>

    首先会按照控件本身分配,分配好tv1,然后按权重分配tv2和他tv3

    如果要想让一个控件占一行的一半怎么办?这时候我们要在layout里加一个weightSum=2

    然后让那个控件的weight=1,就可以了

  • 相关阅读:
    新启发:Relu与dropout的联系
    神经网络之各种激活函数
    Relu激活函数的死神经元问题
    1.openshift搭建
    1.promethues监控融入k8s
    内部yum仓库制作
    python可迭代对象和迭代器和生成器
    python3基本数据类型
    python3的字符串和字节
    2.nginx_rewrite模块
  • 原文地址:https://www.cnblogs.com/84126858jmz/p/4898934.html
Copyright © 2011-2022 走看看