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
  • 相关阅读:
    scrapy爬虫框架学习
    python:面向对象—— __slots__来限制实例的属性命名范围
    列表list 的常用操作
    python replace()用法
    python 字符串 空字符串 len()
    python 字符串 编码问题
    python中语句、函数、类、模块、包之间的关系
    matplotlib 绘制正玄余玄曲线
    Es6/CommonJs/AMD模块系统的差异以及用法
    BOM和DOM的区别
  • 原文地址:https://www.cnblogs.com/zhang1107/p/3125394.html
Copyright © 2011-2022 走看看