zoukankan      html  css  js  c++  java
  • 2-23安卓自学

      今天继续学习Linerlayout,发现Linerlayout可以实现嵌套,即大的布局可以是Linerlayout,然后在大的布局里面还可以嵌套小的Linerlayout

    <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">   
            
        <LinearLayout    
            android:layout_width="0dp"    
            android:layout_height="fill_parent"    
            android:background="#ADFF2F"     
            android:layout_weight="1"/>    
           
            
        <LinearLayout    
            android:layout_width="0dp"    
            android:layout_height="fill_parent"    
            android:background="#DA70D6"     
            android:layout_weight="2"/>    
            
    </LinearLayout>
    但是如果这样写必须有要求,就是一个父Linerlayout如果包含多个字Linerlayout,就要在父Linerlayout声明orientation="horizontal",有两个选项,水平和数竖直,即布局样式

    weight属性详解:

    当然,如果我们不适用上述那种设置为0dp的方式,直接用wrap_content和match_parent的话, 则要接着解析weight属性了,分为两种情况,wrap_content与match_parent!另外还要看 LinearLayout的orientation是水平还是竖直,这个决定哪个方向等比例划分

    这个可以实现更简单的布局划分,按照比例进行分配。

     
  • 相关阅读:
    预警:亚马逊出售的监控摄像机存在预装恶意软件
    opendaylight+openvswitch环境部署
    keepalived+nginx实现高可用
    Huawei ipv6 bgp配置
    F5配置http跳转https
    F5配置ssl卸载
    IBGP路由重分布进IGP路由
    H3C NQA 配置
    Cisco N7K第三方光模块的使用
    Cisco C3850交换机重启后配置无法保存的故障处理
  • 原文地址:https://www.cnblogs.com/ruangongwangxiansheng/p/14906275.html
Copyright © 2011-2022 走看看