学习LinearLayout布局
来源:互联网 发布:ftp网络错误10053 编辑:程序博客网 时间:2024/06/05 06:47
LinearLayout布局其实当我们创建第一个安卓程序的时候就已经看见了,它就在main.xml文件中就已经出现了,那它究竟是什么呢?用简单直译它就是线性布局,它是一个最常见的布局方式,它可以分为水平线性布局和垂直线性布局两种,通过android:orientation属性可以改变布局的方向。其实这个布局说那么多还不如写各程序来看的直接,创建一个安卓程序,写下main.xml里面的代码,其它不用变就可以测试看一下简单的一些例子:
main.xml布局文件内容:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确定"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="消失"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3"
android:background="#000fff"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#ff0000"/>
</LinearLayout>
</LinearLayout>
虽然不止这些,但也不可能一个小小的例子就可以让我们应用自如,还需要我们多加尝试。
- 学习LinearLayout布局
- 学习杂记:android布局 LinearLayout
- Android--布局方式(LinearLayout)学习
- Andriod LinearLayout布局的学习
- Android学习 - LinearLayout布局和RelativeLayout布局
- Android学习笔记06:线性布局LinearLayout
- Android学习 7 -> 线型布局LinearLayout
- Android学习笔记(11):线性布局LinearLayout
- Android学习笔记:线性布局LinearLayout
- Android学习笔记十三之LinearLayout布局
- Android学习笔记十三之LinearLayout布局
- LinearLayout布局
- LinearLayout布局
- LinearLayout布局
- linearlayout 布局
- LinearLayout布局
- LinearLayout布局
- LinearLayout布局
- 开源 免费 java CMS - FreeCMS-功能说明-信息管理 .
- 远程桌面关机三种方法
- C#Winform去掉边框后,窗体最大化,任务栏被遮挡问题!
- 开源 免费 java CMS - FreeCMS-功能说明-信息管理 .
- JNI实例3---扫描SD卡中mp3文件,native层调用Java自定义的类
- 学习LinearLayout布局
- Linux安装和卸载JDK(Java)
- DIV+CSS input样式简单控制
- 开源 免费 java CMS - FreeCMS-功能说明-栏目管理
- java jsp servlet fileupload上传图片时获取上传图片尺寸(宽高)的代码
- 开发中文乱码问题
- windows中通过虚拟机搭建iphone开发环境
- TC脚本开发-窗口句柄的捕捉方法总结
- flex 前后台类的传递