<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->

layout-landlayout-port目录主要用来保存应用程序的界面布局的文件。layout-landandroid应用程序界面横屏显示的布局设置;layout-portandroid应用程序界面竖屏显示的布局设置。由于这两种显示,导致应用程序的显示比例不一样,因此应用程序需要根据不同的比例进行重新布局,不能简单地进行缩放显示,否则就显得界面不好使用,屏幕的空间没有最大化地利用。本来手机的屏幕就是很小的一个显示屏,如果不尽量使用,肯定就不满足用户的需求。当然两种显示的方式,也可以最大化共用相同的图片和字符串等资源。

layout-land的目录下面,有如下的两个文件:

main.xmlhistory_item.xml

接着来查看main.xml,可以看到这个文件的内容如下:

<?xml version="1.0" encoding="utf-8"?>

这行说明XML的版本,编码的格式。

<!--

/*

* Copyright (C) 2008, The Android Open Source Project

*

* Licensed under the Apache License, Version 2.0 (the "License");

* you may not use this file except in compliance with the License.

* You may obtain a copy of the License at

*

* http://www.apache.org/licenses/LICENSE-2.0

*

* Unless required by applicable law or agreed to in writing, software

* distributed under the License is distributed on an "AS IS" BASIS,

* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and

* limitations under the License.

*/

-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#ff000000">

android的应用程序界面里,主要有五种布局方式:帧布局(FrameLayout),线性布局(LinearLayout),绝对布局(AbsoluteLayout),相对布局(RelativeLayout),表格布局(TableLayout)。

在这里主要使用线性布局(LinearLayout),那么这种布局有什么样的特点呢?顾名思义,就是对界面元素进行线性的排列,比如一行有10个文本显示框,如果进行线性布局,并且是水平方向布局,那么就可以排成一行,如果显示屏不够大,后面的元素就显示不了。如果是垂直方向布局,就会每一行一个文本框的方式显示,显示为10行。在线性布局里,如果不指明布局方式,默认为水平方向排列。当然线性布局也可以嵌套显示多行子元素,但这样维护起来比较困难,应使用相对布局(RelativeLayout)来实现,这样更加方便。

更多相关文章

  1. 一步一步学android之布局管理器——LinearLayout
  2. Android:TextView显示富文本信息
  3. Android(安卓)侧拉选择框
  4. android Activity窗体显示状态设置
  5. Android(安卓)自定义Spinner显示条目与下拉框的布局
  6. 代码实现android的一个登录界面
  7. Android(安卓)几种常用关于屏幕操作的方法(获取屏幕大小,全屏,显示
  8. android之通知的使用
  9. android studio线性布局 LinearLayout

随机推荐

  1. Android(安卓)IPC机制—Binder的工作机制
  2. Android(安卓)实现按钮在没有触摸事件时
  3. [随时更新] Android小问题记录
  4. Android技术分享
  5. 【Android测试】Android抓包解析全过程
  6. Android(安卓)Protect-0.签名相关
  7. Android抓包工具使用与错误
  8. Android(安卓)7.1 bootchart触发后导致不
  9. Android(安卓)MVP 详解(下)
  10. Android,一个函数实现计步器(软计步,硬计