线性布局:

 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:orientation="vertical" >
6 <!-- 上下左右全部填充100dp最终是已后加载的为准 -->
7 <TextView
8 android:id="@+id/tv_number"
9 android:layout_width="match_parent"
10 android:layout_height="wrap_content"
11 android:layout_marginLeft="30dp"
12 android:layout_margin="100dp"
13 android:text="请输入电话号码"/>
14 <EditText
15 android:layout_width="match_parent"
16 android:layout_height="wrap_content"
17 android:hint="请输入电话号码"
18 />
19
20
21 <Button
22 android:layout_width="wrap_content"
23 android:layout_height="wrap_content"
24 android:text="拨打"
25 />
26
27 </LinearLayout>

相对布局:

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 tools:context=".MainActivity" >
6 <!-- 相对布局默认都是从左上角开始布局 -->
7 <TextView 8 android:id="@+id/tv_number"
9 android:layout_width="wrap_content"
10 android:layout_height="wrap_content"
11 android:text="请输入电话号码" />
12
13 <EditText
14 android:id="@+id/et_number"
15 android:layout_width="match_parent"
16 android:layout_height="wrap_content"
17 android:hint="请输入电话号码"
18 android:layout_below="@id/tv_number"
19 />
20
21 <Button
22 android:id="@+id/btn_number"
23 android:layout_width="wrap_content"
24 android:layout_height="wrap_content"
25 android:text="拨打"
26 android:layout_below="@id/et_number"
27 />
28
29 <Button
30 android:layout_width="wrap_content"
31 android:layout_height="wrap_content"
32 android:text="按钮"
33 android:layout_toRightOf="@id/btn_number"
34 android:layout_below="@id/et_number"
35 />
36
37
38 </RelativeLayout>

Five Android layouts的更多相关文章

  1. Android应用程序支持不同屏幕(尺寸、密度)

    how to build a user interface using Android layouts for all types of devices 使用Android布局设计的UI接口用于不同的 ...

  2. Android 程序 LinearLayout布局 参数layout_weight 探讨

    官方参考文档 对LinearLayout.LayoutParams中的android:layout_weight解释如下:Indicates how much of the extra space i ...

  3. Android chromium 1

    For Developers‎ > ‎Design Documents‎ > ‎ Java Resources on Android Overview Chrome for Android ...

  4. Space and GridLayout 教程

    Ice Cream Sandwich (ICS) sports two new widgets that have been designed to support the richer user i ...

  5. Android用户界面布局(layouts)

    Android用户界面布局(layouts) 备注:view理解为视图 一个布局定义了用户界面的可视结构,比如activity的UI或是APP widget的UI,我们可以用下面两种方式来声明布局: ...

  6. 第13章、布局Layouts之RelativeLayout相对布局(从零開始学Android)

    RelativeLayout相对布局 RelativeLayout是一种相对布局,控件的位置是依照相对位置来计算的,后一个控件在什么位置依赖于前一个控件的基本位置,是布局最经常使用,也是最灵活的一种布 ...

  7. Android开发:界面设计之六大layouts介绍

    1.帧布局 FrameLayout: FrameLayout是最简单的布局对象.在它里面的的所有显示对象都将固定在屏幕的左上角,不能指定位置,后一个会直接覆盖在前一个之上显示 因为上面的一段话这个是在 ...

  8. Android开发者的Anko使用指南(四)之Layouts

    为什么不使用xml绘制Andoird的UI? 类型不安全 非空不安全 xml迫使你在很多布局中写很多相同的代码 设备在解析xml时会耗费更多的cpu运行时间和电池 最重要的时,它允许任何代码重用 简单 ...

  9. [Android]异步 layout inflation(翻译)

    以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/5829809.html 异步 layout inflation ...

随机推荐

  1. ElasticSearch核心知识总结(二)

    如何超出扩容极限,以及如何提升容错性 primary&replica自动负载均衡,6个shared,3个primary,3个replica,随着机器扩容,会被均衡分配到多台机器上 6个shar ...

  2. Linux - 快速进入目录的方法

    cd命令技巧 直接进入用户的home目录: cd ~ 进入上一个目录: cd - 进入当前目录的上一层目录: cd .. 进入当前目录的上两层目录: cd ../.. 其他常用方法 利用tab键,自动 ...

  3. Linux - 变量的查看与设置

    printenv - print all or part of environment 显示所有变量:print 显示某个变量:print <variable name> 或者 echo ...

  4. typescript 的安装

    1.全局安装 typeScript 包       npm install typescript -g (tsc -v 查看ts版本)2.解决模块的声明文件问题   npm install @type ...

  5. 使用POI导出Excel文件

    创建表头信息 表头信息用于自动生成表头结构及排序 public class ExcelHeader implements Comparable<ExcelHeader>{ /** * ex ...

  6. 正则表达式matcher.group用法

    group是针对括号()来说的,group(0)就是指的整个串,group(1) 指的是第一个括号里的东西,group(2)指的第二个括号里的东西. 上代码: @Test public void te ...

  7. Gradle中使用SpringBoot插件构建多模块遇到的问题

    通常下,多模块的项目如下: Root project 'demospring' +--- Project ':model' \--- Project ':rest' 那么我们需要在rest模块依赖mo ...

  8. mysql 开发进阶篇系列 39 mysql日志之二进制日志(binlog)

    一.概述 二进制日志(binlog)记录了所有的DDL(数据定义语言)语句和DML(数据操纵语言)语句,但是不包括数据查询语句, 语句以"事件"的形式保存,它描述了数据的更改过程, ...

  9. rfc2818 --- HTTP Over TLS

    协议链接 本协议描述了如何使用TLS来对Internet上的HTTP进行安全加固. 2.1. Connection Initiation(链接初始化) HTTP client同时也作为TLS clie ...

  10. postgresql 清空数据表 truncate

    在 mysql 中如果需要清空表,只需要 TRUNCATE table_name; 即可,如果有自增的 id 字段,也会还原回 1, 但是 postgresql 与 mysql 稍有不同,postgr ...