Five Android layouts
线性布局:
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的更多相关文章
- Android应用程序支持不同屏幕(尺寸、密度)
how to build a user interface using Android layouts for all types of devices 使用Android布局设计的UI接口用于不同的 ...
- Android 程序 LinearLayout布局 参数layout_weight 探讨
官方参考文档 对LinearLayout.LayoutParams中的android:layout_weight解释如下:Indicates how much of the extra space i ...
- Android chromium 1
For Developers > Design Documents > Java Resources on Android Overview Chrome for Android ...
- Space and GridLayout 教程
Ice Cream Sandwich (ICS) sports two new widgets that have been designed to support the richer user i ...
- Android用户界面布局(layouts)
Android用户界面布局(layouts) 备注:view理解为视图 一个布局定义了用户界面的可视结构,比如activity的UI或是APP widget的UI,我们可以用下面两种方式来声明布局: ...
- 第13章、布局Layouts之RelativeLayout相对布局(从零開始学Android)
RelativeLayout相对布局 RelativeLayout是一种相对布局,控件的位置是依照相对位置来计算的,后一个控件在什么位置依赖于前一个控件的基本位置,是布局最经常使用,也是最灵活的一种布 ...
- Android开发:界面设计之六大layouts介绍
1.帧布局 FrameLayout: FrameLayout是最简单的布局对象.在它里面的的所有显示对象都将固定在屏幕的左上角,不能指定位置,后一个会直接覆盖在前一个之上显示 因为上面的一段话这个是在 ...
- Android开发者的Anko使用指南(四)之Layouts
为什么不使用xml绘制Andoird的UI? 类型不安全 非空不安全 xml迫使你在很多布局中写很多相同的代码 设备在解析xml时会耗费更多的cpu运行时间和电池 最重要的时,它允许任何代码重用 简单 ...
- [Android]异步 layout inflation(翻译)
以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/5829809.html 异步 layout inflation ...
随机推荐
- Redis简明教程
redis是什么: Redis is an open source, BSD licensed, advanced key-value store. It is often referred to a ...
- Info - 信息获取途径汇总
目的驱动 大多数情况下,都是为了解决某个问题或完成某项任务,才需要进行针对性的.大范围的.细致化的信息获取. 那么,信息获取的方式和来源,就应该紧紧围绕这个"问题和任务"本身来确定 ...
- Angular使用总结 --- 通过指令动态添加组件
之前自己写的公共组件,都是会先引入,需要调起的时候再通过service控制公共组件状态.值.回调函数什么的.但是有一些场景不适合这种方式,还是动态添加组件更加好.通过写过的一个小组件来总结下. 创建组 ...
- Django项目中使用celery做异步任务
异步任务介绍 在写项目过程中经常会遇到一些耗时的任务, 比如:发送邮件.发送短信等等~.这些操作如果都同步执行耗时长对用户体验不友好,在这种情况下就可以把任务放在后台异步执行 celery就是用于处理 ...
- Python函数——装饰器
前言 给下面的函数加上运行时间 def fib(n): a, b = 0, 1 for i in range(n): print(b) a, b = b, a+b return b a = fib(5 ...
- 如何更优雅的在kubernetes平台下记录日志
背景 传统项目里面记录日志大多数都是将日志记录到日志文件,升级到分布式架构以后,日志开始由文件转移到elasticsearch(es)中来存储,达到集中管理.在kubernetes平台里面把日志记录到 ...
- myslide 插件开发知识点总结和 css3 动画性能问题的研究
myslide 插件开发知识点总结和 css3 动画性能问题的研究 这篇文章主要是总结最近开发过程中遇到的问题.有几个问题又是不容易发现原因的问题,但是最后的结果又是很简单的. 1.手机端的 slid ...
- Spring Cloud Ribbon入门
一.简介 Spring Cloud Ribbon是一个基于Http和TCP的客户端负载均衡工具,它是基于Netflix Ribbon实现的.它不像服务注册中心.配置中心.API网关那样独立部署,但是它 ...
- mysql表分区实战
一,什么是数据库分区以mysql为例,mysql数据库中的数据是以文件的形势存在磁盘上的,默认放在/mysql/data下面 (可以通过my.cnf中的datadir来查看),一张表主要对应着三个文件 ...
- 梯度下降法原理与python实现
梯度下降法(Gradient descent)是一个一阶最优化算法,通常也称为最速下降法. 要使用梯度下降法找到一个函数的局部极小值,必须向函数上当前点对应梯度(或者是近似梯度)的反方向的规定步长距离 ...