zoukankan      html  css  js  c++  java
  • android布局之线性布局

    LinearLayout 线性布局有两种,分别是水平线性布局和垂直线性布局,LinearLayout属性中android:orientation为设置线性布局当其="vertical"时,为 垂直线性布局,当其="horizontal"时,为水平线性布局,不管是水平还是垂直线性布局一行(列)只能放置一个控件。

    下面我们举例说明:

    垂直线性布局

    <?xml version="1.0" encoding="utf-8"?>  
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
            android:layout_width="match_parent"  
            android:layout_height="match_parent"  
            android:orientation="vertical" >  
          
            <EditText   
                android:layout_width="100dp"  
                android:layout_height="wrap_content"  
                  
                />  
              
            <Button   
                android:layout_width="100dp"  
                android:layout_height="wrap_content"  
                android:text="Button1"/>  
          
            <Button   
                android:layout_width="100dp"  
                android:layout_height="wrap_content"  
                android:text="button2"/>  
          
        </LinearLayout> 


    运行的结果:

    水平线性布局:

    <?xml version="1.0" encoding="utf-8"?>  
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
            android:layout_width="match_parent"  
            android:layout_height="match_parent"  
            android:orientation="horizontal" >  
              
            <EditText   
                android:layout_width="100dp"  
                android:layout_height="wrap_content"  
                />  
              
            <Button   
                android:layout_width="100dp"  
                android:layout_height="wrap_content"  
                android:text="Button1"/>  
          
            <Button   
                android:layout_width="100dp"  
                android:layout_height="wrap_content"  
                android:text="button2"/>  
          
        </LinearLayout>  


    运行结果:

  • 相关阅读:
    websocket协议
    LeakCanary 中文使用说明
    编程习惯1
    Spring事务管理(详解+实例)
    微信 JS API 支付教程
    mi面试题
    最锋利的Visual Studio Web开发工具扩展:Web Essentials详解(转)
    .Net 高效开发之不可错过的实用工具
    手机版开发框架集合
    node.js建立简单应用
  • 原文地址:https://www.cnblogs.com/snake-hand/p/3178029.html
Copyright © 2011-2022 走看看