线性布局管理器 (LinearLayout)里嵌套相对布局管理器(RelativeLayout)
线性布局管理器分为水平布局和垂直布局
水平布局(horizontal):组件从左往右进行排列,所有组件占一行,每一个组件占一列
垂直布局(vertical):组件从上到下进行排列,左右组件占一列,每一个组件占一行
相对布局管理器是按照组件的相对位置进行摆放的,我们可以指定一个组价相对于另一个组件的位置

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context="com.example.mypc.android.MainActivity"android:paddingBottom="16dp"android:paddingLeft="16dp"android:paddingRight="16dp"android:paddingTop="16dp"android:orientation="vertical"><TextView
        android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Hello World!"android:textColor="#FF0077FF"android:textSize="20sp"/><EditText
        android:layout_width="match_parent"android:layout_height="wrap_content"android:hint="账号/手机号/邮箱/QQ号"android:paddingTop="20dp"/><EditText
        android:layout_width="match_parent"android:layout_height="wrap_content"android:hint="密码"android:inputType="number"android:paddingTop="10dp"/>
<RelativeLayout
    android:layout_width="match_parent"android:layout_height="wrap_content"><Button
        android:id="@+id/button1"android:layout_marginTop="30dp"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="注册"android:layout_marginLeft="70dp"android:textSize="20sp"android:textColor="#FF0077FF"android:backgroundTint="#FF8247"/><Button
        android:layout_toRightOf="@id/button1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="登录"android:layout_marginTop="30dp"android:layout_marginLeft="50dp"android:textSize="20sp"android:textColor="#FF0077FF"android:backgroundTint="#FF8247"/></RelativeLayout>></LinearLayout>

效果图:

我们需要注意的就是怎么通过布局管理器的特点以及嵌套来控制各组件的位置以及布局管理器嵌套的代码格式
控制注册按钮与上面编辑框的距离代码android:layout_marginTop="30dp"
控制注册按钮与容器左边的距离代码android:layout_marginLeft="70dp"
控制登录按钮相对于注册按钮的距离代码android:layout_marginLeft="50dp"

Android学习之布局管理器嵌套相关推荐

  1. android 布局管理器,【Android开发】布局管理器-表格布局

    在XML布局文件中定义表格布局管理器的基本语法: 属性列表 > 需要添加的UI组件 多个TableRow TableLayout支持的XML属性: android:collapseColumns ...

  2. Android布局管理器-从实例入手学习相对布局管理器的使用

    场景 AndroidStudio跑起来第一个App时新手遇到的那些坑: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103797 ...

  3. 【Android开发】布局管理器-线性布局

    这里实现垂直布局和水平布局: 垂直布局效果图: 实现代码: 垂直线性布局 res/layout/main.xml: <LinearLayout xmlns:android="http: ...

  4. 布局管理器的嵌套实现微信朋友圈界面

    布局管理器的嵌套实现微信朋友圈界面 布局管理器嵌套原则: 根布局管理器必须包含xmlns属性 在一个布局文件中,最多只能有一个根布局管理器,如果需要有多个还需要使用一个根布局管理器将他们括起来. 不能 ...

  5. Android布局管理器-使用LinearLayout实现简单的登录窗口布局

    场景 Android布局管理器-从实例入手学习相对布局管理器的使用: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/1038389 ...

  6. 疯狂Android讲义(二)——第二部分:第1组UI组件(布局管理器)

    一.第1组UI组件:布局管理器 Android 的界面组件比较多,不利于掌握它们内在的关系.为了帮助读者更好地掌握Android界面组件的关系,本书将会把这些界面组件按照它们的关联分析,分为几组进行介 ...

  7. Android精讲--界面编程2(布局管理器)

    为什么需要布局管理器 为了更好地管理Android应用的用户界面里的各种组件,Android提供了布局管理器.通过使用布局管理器,Android应用的图形用户界面具有良好的平台无关性.通常来说,推荐使 ...

  8. Android中常见五种布局管理器——RelativeLayout、LinearLayout、FrameLayout、TableLayout、GridLayout

    目录 布局管理器 RelativeLayout 常见属性 Relative的实践操作(实现软件更新界面) LinearLayout 常见属性 LinearLayout的实践操作(模范登录以及微信底部) ...

  9. 【android编程】 第三讲-Android布局管理器

    android编程 第三讲 Android布局管理器 文章目录 android编程 第三讲 Android布局管理器 约束布局管理器ConstraintLayout 线性布局管理器LinearLayo ...

最新文章

  1. 【ios开发/Xcode】使用UITableView完成学生信息及成绩的显示
  2. 抢购网站服务器时间表,js获取服务器时间,实现抢购倒计时
  3. 沧海一声笑,移动应用的CRASH原因我找到! --记最新款数字化測试“星云測试“的使用攻略...
  4. 步步为营VS 2008 + .NET 3.5系列文章索引
  5. Eclipse中io操作提示找不到文件
  6. 深圳php和java,深圳java技术培训学习(Java和PHP区别)
  7. java并行流 阻塞主线程_多线程入门案例与java8的并行流
  8. mysql 储存引擎_详解mysql存储引擎的标准
  9. Esxi直接使用vmdk文件创建虚机
  10. 搭建apache_??4、Apache环境web搭建
  11. AT5 two-dimensional objects - the torus and genus
  12. 自然语言处理的会议、论文集下载
  13. 软件用户手册编写指南(GB8567一88/GB8567一2006)
  14. GitHub开源项目学习 电商系统Mall (一) Mall简介
  15. Android:系统日历同步日程
  16. 前后端分离页面500错误,控制台不打印错误日志的错误定位
  17. 敏捷项目如何保证测试质量
  18. 牛客网——B-栈和排序
  19. 读取文件夹下同类型文件的文件名并排序(实例)
  20. ibm服务器进不去系统怎么回事,IBM X3400服务器故障开机进不去系统

热门文章

  1. 除了随机还要进化——对Infinity进一步的想法
  2. 关于ArcGIS动态图层空间内栅格数据,JS前端显示颜色不正确的解决方案
  3. ASP Session的功能的缺陷以及解决方案
  4. Chart控件X轴显示不全的解决方法
  5. 蓝桥杯基础练习字母图形
  6. 费诺编码c语言实验报告,formal parameter 4 different from declaration
  7. ubuntu 12.04 mysql_Ubuntu 12.04 mysql 源码安装--mysql.5.5.x
  8. 跨境商家为什么要建自己的独立站?
  9. Windows 与 Linux 通过Xshell 文件互传
  10. 蓝桥杯 基础练习 阶乘计算