• 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
  • 相关阅读:
    【情感计算】资源
    有意思的网站
    【NLP】新词发现
    [openwrt]网络配置
    【SSH】远程下载
    【OpenWRT】网络配置
    [SSH]连接失败
    [Openwrt]wifi桥接设置
    【Openwrt】刷
    【Python】excel
  • 原文地址:https://www.cnblogs.com/zhang1107/p/3125394.html
Copyright © 2020-2023  润新知