您的位置:首页 > 移动开发 > Android开发

android第六步深入了解各种布局技术

2014-03-11 11:35 453 查看
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表格布局
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: