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
  • 相关阅读:
    http://localhost:8080/ 演出Oracle说明
    JS浏览器类型推断方法
    MVC设计模式JavaWeb实现
    《TCP/IP详细说明》读书笔记(17章)-TCP传输控制协定
    创建表单
    道路软件质量:SourceMonitor
    HDU
    HDU 3032 Nim or not Nim? (sg函数求解)
    OpenWRT推理client线上的数
    IIS的ISAPI接口简介
  • 原文地址:https://www.cnblogs.com/zhang1107/p/3125394.html
Copyright © 2011-2022 走看看