<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />

</LinearLayout>

解释上面代码的意思:

<LinearLayout>标签:定义了整个程序显示的布局。

在LinearLayout布局中,android:orientation用于定义布局中子元素的排列方式,布局包含两种排列方式:vertical(垂直排列)和horizontal(水平排列)。

android:layout_width 定义了元素布局的宽度,可以通过三种方式来指定宽度。

1)fill_parent:宽度和父元素相同;

2)wrap_content:宽度随组件本身的内容调整;

3):通过指定px值来设置宽度。

android:layout_height 定义了元素布局的高度,可以通过三种方式来指定高度。

1)fill_parent:宽度和父元素相同;

2)wrap_content:宽度随组件本身的内容调整;

3):通过指定px值来设置宽度。



更多相关文章

  1. Android(安卓)简单计算器源码....
  2. Android(安卓)线性布局(LinearLayout)相关官方文档 - 布局参数部分
  3. Android加速启动Activity
  4. Android(安卓)不同View ID相同
  5. TextView的常用属性
  6. android 实现FlowLayout 流线布局(自定义ViewGroup)
  7. TextView属性大全!技术干货
  8. 第八章 Android(安卓)开发常见的UI布局
  9. android——Include进来的GridView无法显示

随机推荐

  1. 解决eclipse中查看android工程代码出现an
  2. 【Android】上传代码至JCenter
  3. Kotlin学习笔记---持续更新中
  4. Android回顾/Intent的使用
  5. Android之Bundle类
  6. 使用Tensorflow部署手机端app之将TensorF
  7. 关于android生成debug和release版
  8. Android的页面管理控件ViewFlipper
  9. Android之app作为服务器解决跨域问题
  10. Android分享---调用系统自带的分享功能