android第六步深入了解各种布局技术
1.相对布局
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/numbertxt" //id
android:text="@string/number" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/number"
android:layout_toRightOf="@id/numbertxt" //textview d
android:layout_alignTop="@id/numbertxt" //textview d
android:layout_marginLeft="5dp"/> //控件间距
</RelativeLayout>
android:layout_与那个控件相对应
android:layout_align设置的是控件与控件之间对齐的方式
android:layout_alignParent设置控件与父控件之间对齐的方式
android:layout_center设置控件的方向
2.FrameLayout 布局叠加摆放
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/moive"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image"
android:layout_gravity="center"/>
</FrameLayout>
3.TableLayout表格布局