• 2021.2.17 LinearLayout


    一、今日学习内容

      

    LinearLayout:线性布局管理器

    1、特点:将放入其中的组件按照垂直或水平的方向进行排列


    2、垂直线性布局管理器:

    android:orientation="vertival"

    每一行只能放置一个组件


    3、水平线性布局管理器:

    android:orientation="horizontal"

    每一列只能放置一个组件


    4、<LinearLayout>标记常用属性:

    android:orientation:设置排列方式

    android:gravity:设置显示位置


    5、子组件属性

    android:layout_weight属性:设置组件占父容器空间的比例,默认值为0.分配的是屏幕剩余空间

    复制代码
     1 <?xml version="1.0" encoding="utf-8"?>
     2 <LinearLayout
     3     xmlns:android="http://schemas.android.com/apk/res/android"
     4     xmlns:tools="http://schemas.android.com/tools"
     5     android:id="@+id/activity_main"
     6     android:layout_width="match_parent"
     7     android:layout_height="match_parent"
     8     android:paddingLeft="@dimen/activity_horizontal_margin"
     9     android:paddingRight="@dimen/activity_horizontal_margin"
    10     android:paddingTop="@dimen/activity_vertical_margin"
    11     android:paddingBottom="@dimen/activity_vertical_margin"
    12     android:orientation="vertical"
    13     tools:context="com.example.example.MainActivity">
    14 
    15     <EditText
    16         android:layout_width="match_parent"
    17         android:layout_height="wrap_content"
    18         android:paddingBottom="20dp"
    19         android:hint="QQ号/微信号/Email"
    20         android:drawableLeft="@mipmap/zhanghao"
    21         />
    22 
    23     <EditText
    24         android:layout_width="match_parent"
    25         android:layout_height="wrap_content"
    26         android:paddingBottom="20dp"
    27         android:hint="密码"
    28         android:drawableLeft="@mipmap/mima"
    29         />
    30     <Button
    31         android:layout_width="match_parent"
    32         android:layout_height="wrap_content"
    33         android:text="登录"
    34         android:textColor="#FFFFFF"
    35         android:background="#FF009688"/>
    36 
    37     <TextView
    38         android:layout_width="wrap_content"
    39         android:layout_height="wrap_content"
    40         android:text="登陆遇到问题?"
    41         android:layout_gravity="center_horizontal"
    42         android:paddingTop="20dp"/>
    43 
    44 </LinearLayout>
    复制代码

    二、遇到的问题

       没有遇到什么问题

    三、明日计划

        明天学习关于帧布局管理器的内容

  • 相关阅读:
    查看服务器被动手脚
    cordova安卓sdk
    Nginx 启动报错 “/var/run/nginx/nginx.pid" failed”
    家庭里如何搭建一个互联网可访问的服务器
    Mysql5.7基于事务转为基于日志
    021 基本数据类型小结
    018 字符串类型及操作
    022 程序的控制结构
    020 实例4-文本进度条
    017 示例3-天天向上的力量
  • 原文地址:https://www.cnblogs.com/wmdww/p/14864721.html
Copyright © 2020-2023  润新知