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
  • 相关阅读:
    相当当中 ,还用到一个很重要的类 ,map地图类
    使用ObjectDataSource查询和更新
    sqlserver 简单的存储过程学习记录
    一个winform的基于TCP的服务端的GPS平台的网关。利用多线程异步的方式 。
    个人网站准备之数据处理
    记录日志(自治事务
    android调用lua
    CMarkup类读写xml文件
    MyBatis.Net 配置
    NPOI读取Excel到集合对象
  • 原文地址:https://www.cnblogs.com/zhang1107/p/3125394.html
Copyright © 2011-2022 走看看