技术博客: http://blog.sina.com.cn/s/articlelist_1766082610_0_1.html

 

andoid的UI组件学习,首先需要需要学习组件的布局,各种组件均必须放到布局里面,才可以显示,下面就记录下几种常用的布局:
1、LinearLayout(线形布局)
<?xml version="1.0" encoding="utf-8"?>
http://schemas.android.com/apk/res/android"
 android:orientation="vertical" android:layout_width="fill_parent"
 android:layout_height="fill_parent">

属性介绍:
android:orientation="vertical"  表示这个布局里面的组件子元素都是上下垂直的摆放
android:orientation="horizontal"  表示这个布局里面的组件子元素都是左右水平的摆放
android:layout_width="fill_parent"  表示布局的面板的宽度占满屏幕
android:layout_height="fill_parent"  表示布局的面板的高度占满屏幕
2、RelativeLayout(相对布局)
 xmlns:android=" http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent" android:layout_height="wrap_content"
 android:background="@drawable/blue" android:padding="10dip">    android:layout_height="wrap_content" android:text="请输入用户名:" />
 
   android:layout_height="wrap_content"
  android:background="@android:drawable/editbox_background"
  android:layout_below="@id/label" />