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>  


    运行结果:

  • 相关阅读:
    C#开发ActiveX控件并应用于网页
    C#编写ActiveX控件
    WPF Step By Step 系列5-Prism框架在项目中使用
    WPF Step By Step4- 自定义模板
    WPF Step By Step3- 控件介绍
    WPF Step By Step2 -基础知识介绍
    WPF Step By Step 系列1
    斑马打印机设定值取值优先级顺序
    WPF资料汇总
    linux(centos8):使用cgroups做资源限制
  • 原文地址:https://www.cnblogs.com/snake-hand/p/3178029.html
Copyright © 2011-2022 走看看