LinearLayout 将其子View顺序排成一行或是一列,一个垂直列表每行将只有一个子元素(无论它们有多宽),一个水平列表只是一列的高度(最高子元素的高度来填充)。

本例介绍了LinearLayout 的基本用法,LinearLayout的方向可以使用android:orientation 来定义,可以指定vertical 或是 horizontal ,缺省为横向horizontal。

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”vertical”
android:background=”@drawable/blue”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”>

<!– view1 goes on top –>
<TextView
android:background=”@drawable/box”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/linear_layout_1_top”/>

<!– view2 goes in the middle –>
<TextView
android:background=”@drawable/box”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/linear_layout_1_middle”/>

<!– view3 goes on the bottom –>
<TextView
android:background=”@drawable/box”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/linear_layout_1_bottom”/>

</LinearLayout>

Layouts->LinearLayout->1. Vertical_第1张图片" src="https://img.it610.com/image/info5/812e02b8c7b046358473776ffd39c772.jpg" width="331" height="491" style="border:1px solid black;">

更多相关文章

  1. Android(安卓)用 ListView 实现倒计时列表功能
  2. Android布局方式(AbsoluteLayout)学习
  3. Android之Weight属性源码解析
  4. 安卓布局之线性布局(Linearlayout)
  5. Android流式布局FlowLayout
  6. 记录-解决设置透明状态栏,软键盘弹起问题
  7. Andriod 实现可拖动列表
  8. 对话框大合集
  9. Android(安卓)ListView的每个子Item如何设置高度

随机推荐

  1. Android(安卓)发送短信 源代码
  2. android用ViewPager实现欢迎界面
  3. android input 事件传递主要流程
  4. Android中获取屏幕的宽和高
  5. Android(安卓)studio 中调用ndk-build 进
  6. Windows下Android开发环境配置的一种方法
  7. Android通知栏消息(基本文字通知)
  8. Android中通过浏览器打开一个网页
  9. MTK Android(安卓)Driver :camera
  10. API指南----application