zoukankan      html  css  js  c++  java
  • LinearLayout学习

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" <!--垂直布局-->
            >
            <EditText 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            />
        </LinearLayout>
        
        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" <!--水平布局-->
            android:gravity="right"
            >
            <Button 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="确定"
            />
             <Button 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="取消"
            />
        </LinearLayout>
        
        <TextView 
            android:layout_weight="2"   //调整比例
            android:layout_height="wrap_content"
            android:layout_width="fill_parent" 
            android:background="#0000FF"
            />
        
        <TextView 
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:background="#FF00FF"
            />
    View Code

     一个LinearLayout综合配置的列子(包括水平布局和垂直布局):

    <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:orientation="horizontal"
            >
            <TextView
            android:text="红色"
            android:gravity="center_horizontal|center_vertical"
            android:background="#AA0000" 
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            />
            <TextView
            android:text="绿色"
            android:gravity="center_horizontal"
            android:background="#00AA00" 
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            />
            <TextView
            android:text="蓝色"
            android:gravity="center|bottom"
            android:background="#0000AA" 
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            />
            <TextView
            android:text="黄色"
            android:gravity="bottom"
            android:background="#AAAA00" 
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            />
        </LinearLayout>
        
        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:orientation="vertical"
            >
            <TextView
            android:text="第一行"
            android:textSize="15sp"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            />
            <TextView
            android:text="第二行"
            android:textSize="15sp"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            />
               <TextView
            android:text="第三行"
            android:textSize="15sp"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            />
               <TextView
            android:text="第四行"
            android:textSize="15sp"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            />
        </LinearLayout>
    View Code
  • 相关阅读:
    centos7系统中忘记了root管理员账号密码的解决方式
    【python之路48】生成器表达式、推导式
    小米集团信息化中台战略
    分时函数
    函数节流
    JS浮点计算问题
    要转型做前端开发了
    优秀的开发人员和测试人员应有的态度
    C#数组的笔记
    LINQ不包含列表
  • 原文地址:https://www.cnblogs.com/zhang1107/p/3125394.html
Copyright © 2011-2022 走看看