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 ...
随机推荐
- C#6.0语言规范(一) 介绍
C#(发音为“See Sharp”)是一种简单,现代,面向对象,类型安全的编程语言.C#源于C语言系列,对C,C ++和Java程序员来说很熟悉.EC#International将EC#标准化为ECM ...
- OpenGL ES: iOS 自定义 UIView 响应屏幕旋转
iOS下使用OpenGL 如果使用GLKit View 那么不用担心屏幕旋转的问题,说明如下: If you change the size, scale factor, or drawable pr ...
- LeetCode--No.014 Longest Common Prefix
14. Longest Common Prefix Total Accepted: 112204 Total Submissions: 385070 Difficulty: Easy Write a ...
- RawConfigParser 与 ConfigParser ——Python的配件文件读取模块
一般情况都是使用ConfigParser这个方法,但是当我们配置中有%(filename)s这种格式的配置的时候,可能会出现以下问题: configparser.InterpolationMissin ...
- Xamarin.Android 使用 SQLite 出现 Index -1 requested, with a size of 10 异常
异常: Android.Database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 10 此错误是数据返回 ...
- [原]ZolltyMVC框架简介
ZolltyMVC框架是一款轻量级的Java应用编程框架(Java Application Framework),融合了常用的IOC/DI.MVC(注解.XML配置式.RESTful风格.模型驱动.视 ...
- UFLDL 教程学习笔记(四)主成分分析
UFLDL(Unsupervised Feature Learning and Deep Learning)Tutorial 是由 Stanford 大学的 Andrew Ng 教授及其团队编写的一套 ...
- 213. Orchard学习 二 3、001.IOrchardHost 与Autofac
继前篇,在Orchard Application_Start() -> HostInitialization() 里,调用 OrchardStarter.CreateHost创建IOrchard ...
- php持续推送信息到客户端的方法
<?php set_time_limit(0); $i=1; while($i++) { echo $i,'<br />'; ob_flush();//冲刷出(送出)输出缓冲区中的内 ...
- Asp.net Webform 使用Repository模式实现CRUD操作代码生成工具
Asp.net Webform 使用Repository模式实现CRUD操作代码生成工具 介绍 该工具是通过一个github上的开源项目修改的原始作者https://github.com/Supere ...