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表格布局
<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表格布局
相关文章推荐
- (九)8天快速掌握Android视频教程_深入了解各种布局技术
- Android学习笔记---09_深入了解各种布局技术
- 09_深入了解各种布局技术
- Android 各种布局技术-五大布局对象
- Android自定义View的实现方法,带你一步步深入了解View(四)
- Android 开发之旅:深入分析布局文件&又是“Hello World!”
- Android布局中如何精确计算以适应各种屏幕
- Android LayoutInflater原理分析,带你一步步深入了解View(一)
- Android视图绘制流程完全解析,带你一步步深入了解View(二)
- android 界面中的各种布局
- Android NFC开发(一)——初探NFC,了解当前前沿技术
- Android自定义View的实现方法,带你一步步深入了解View(四)
- Android自定义View的实现方法,带你一步步深入了解View(四)
- 深入了解android平台的jni(二)
- android官方技术文档翻译——设计时布局属性
- 3个你未必了解的Android Hot Fix技术
- Android自定义View的实现方法,带你一步步深入了解View(四)
- 一个Demo了解android中的hook技术
- android:布局参数,控件属性及各种xml的作用
- 深入了解android平台的jni