线性布局是一个视图组,它所有的子视图都在一个方向对齐,水平或者垂直。

你可以指定布局的方向通过android:orientation 属性。、

Tips: 注意点:android中的LinearLayout使用时,当一行填满时候,不会自动换行,

出的将不会被显示。

代码:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical"     android:paddingLeft="16dip"     android:paddingRight="16dip" >      <EditText         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:hint="@string/to" />      <EditText         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:hint="@string/subject" />      <EditText         android:layout_width="fill_parent"         android:layout_height="0dp"         android:layout_weight="1"         android:gravity="top"         android:hint="@string/message" />      <Button         android:layout_width="100dp"         android:layout_height="wrap_content"         android:layout_gravity="right"         android:text="@string/send" />  </LinearLayout> 
截图如下:

更多相关文章

  1. Manifest中Activity的一些配置
  2. Android(安卓)解决setRequestedOrientation之后手机屏幕的旋转不
  3. android截图代码
  4. Android提高第十九篇之"多方向"抽屉[转]
  5. Android(安卓)中文 API (90) —— WindowManager
  6. android自定义视图属性(atts.xml,TypedArray)学习
  7. Android的用户界面
  8. android中文api(89)――ViewManager
  9. LinearLayout(线性布局)

随机推荐

  1. Android中解析XML
  2. Android(安卓)button原理 转载
  3. Android图片异步加载之Android-Universal
  4. Android(安卓)之 Looper Handler Message
  5. android蓝牙遥控车
  6. android平台下基于cmake编译链接ffmpeg-3
  7. Android(安卓)项目实践(二)——网络连接
  8. Android(安卓)4.0的图形硬件加速及绘制技
  9. 3D激光扫描三维重建——6.(android)系统框
  10. eclipse新建android工程出现This templat