Android学习指南 第六讲:用户界面 View(二)
<?xml version=”1.0″ encoding=”utf-8″?> <AbsoluteLayout android:id=”@+id/AbsoluteLayout01″ android:layout_width=”fill_parent” android:layout_height=”fill_parent” xmlns:android=”http://schemas.android.com/apk/res/android” android:background=”#fff”><ImageView android:src=”@drawable/android” android:layout_y=”40dip” android:layout_width=”wrap_content” android:layout_x=”35dip” android:id=”@+id/ImageView01″ android:layout_height=”wrap_content”> </ImageView> <TextView android:layout_height=”wrap_content” android:layout_width=”fill_parent” android:id=”@+id/TextView01″ android:text=”Android2.2 学习指南” android:textColor=”#0f0″ android:textSize=”28dip” android:layout_y=”330dip” android:layout_x=”35dip“> </TextView> <TextView android:layout_height=”wrap_content” android:layout_width=”fill_parent” android:id=”@+id/TextView02″ android:text=”图文并茂,理论清晰,操作性强” android:textColor=”#333″ android:textSize=”18dip” android:layout_y=”365dip” android:layout_x=”35dip“> </TextView> </AbsoluteLayout>
让我们看一下在WQVGA的模拟器下的显示效果:
<?xml version=”1.0″ encoding=”utf-8″?><RelativeLayout android:id=”@+id/RelativeLayout01″ android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:background=”#fff” xmlns:android=”http://schemas.android.com/apk/res/android”><ImageView android:id=”@+id/ImageView01″ android:src=”@drawable/android” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_marginTop=”40dip” > </ImageView> <TextView android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:id=”@+id/TextView01″ android:text=”Android2.2 学习指南” android:textColor=”#0f0″ android:textSize=”28dip” android:layout_below=”@id/ImageView01″ android:layout_centerHorizontal=”true” android:layout_marginTop=”10dip”> </TextView> <TextView android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:id=”@+id/TextView02″ android:text=”图文并茂,理论清晰,操作性强” android:textColor=”#333″ android:textSize=”18dip” android:layout_below=”@id/TextView01″ android:layout_centerHorizontal=”true” android:layout_marginTop=”5dip“> </TextView> </RelativeLayout>
让我们看一下在WQVGA的模拟器下的显示效果:
第一类:属性值为true或false
android:layout_centerHrizontal 水平居中
android:layout_centerVertical 垂直居中
android:layout_centerInparent 相对于父元素完全居中
android:layout_alignParentBottom 贴紧父元素的下边缘
android:layout_alignParentLeft 贴紧父元素的左边缘
android:layout_alignParentRight 贴紧父元素的右边缘
android:layout_alignParentTop 贴紧父元素的上边缘
android:layout_alignWithParentIfMissing 如果对应的兄弟元素找不到的话就以父元素做参照物第二类:属性值必须为id的引用名“@id/id-name”
android:layout_below 在某元素的下方
android:layout_above 在某元素的的上方
android:layout_toLeftOf 在某元素的左边
android:layout_toRightOf 在某元素的右边android:layout_alignTop 本元素的上边缘和某元素的的上边缘对齐
android:layout_alignLeft 本元素的左边缘和某元素的的左边缘对齐
android:layout_alignBottom 本元素的下边缘和某元素的的下边缘对齐
android:layout_alignRight 本元素的右边缘和某元素的的右边缘对齐第三类:属性值为具体的像素值,如30dip,40px
android:layout_marginBottom 离某元素底边缘的距离
android:layout_marginLeft 离某元素左边缘的距离
android:layout_marginRight 离某元素右边缘的距离
android:layout_marginTop 离某元素上边缘的距离我们再把上面的例子重新做一遍,这一次多放一些属性在里面,大家试验一下:<?xml version=”1.0″ encoding=”utf-8″?><RelativeLayout android:id=”@+id/RelativeLayout01″ android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:background=”#cfff” 色彩的设置是argb,第一个c是透明度 xmlns:android=”http://schemas.android.com/apk/res/android”><ImageView android:id=”@+id/ImageView01″ android:src=”@drawable/android” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_marginTop=”40dip” android:layout_centerHorizontal=”true”> </ImageView><TextView android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:id=”@+id/TextView01″ android:text=”Android2.2 学习指南” android:textColor=”#0f0″ android:textSize=”28dip” android:layout_below=”@id/ImageView01″ android:layout_centerHorizontal=”true” android:layout_marginTop=”10dip”> </TextView><TextView android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:id=”@+id/TextView02″ android:text=”图文并茂,理论清晰,操作性强” android:textColor=”#333″ android:textSize=”18dip” android:layout_below=”@id/TextView01″ android:layout_centerHorizontal=”true” android:layout_marginTop=”5dip”> </TextView><TextView android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:id=”@+id/TextView03″ android:text=”alignTop” android:textColor=”#333″ android:textSize=”18dip” android:layout_alignTop=”@id/ImageView01″ 和ImageView01上边缘对齐 android:layout_centerHorizontal=”true”> </TextView><TextView android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:id=”@+id/TextView04″ android:text=”alignLeft” android:textColor=”#333″ android:textSize=”18dip” android:layout_alignLeft=”@id/ImageView01″ android:layout_centerHorizontal=”true”> </TextView><TextView android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:id=”@+id/TextView05″ android:text=”alignRight” android:textColor=”#333″ android:textSize=”18dip” android:layout_alignRight=”@id/ImageView01″ android:layout_centerHorizontal=”true”> </TextView><TextView android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:id=”@+id/TextView06″ android:text=”alignBottom” android:textColor=”#333″ android:textSize=”18dip” android:layout_alignBottom=”@id/ImageView01″ android:layout_centerHorizontal=”true”> </TextView> </RelativeLayout><ignore_js_op>
转载于:https://www.cnblogs.com/yinxiangpei/articles/2495701.html
Android学习指南 第六讲:用户界面 View(二)相关推荐
- 《Android学习指南》目录
转自:http://android.yaohuiji.com/about Android学习指南的内容分类: 分类 描述 0.学习Android必备的Java基础知识 没有Java基础的朋友,请不要先 ...
- Android 学习指南(2017版)
Android 学习指南 不断有新人来询问如何学习Android,很多都是无从下手,没有任何概念.正好好久没写文章了,今天来整理一下Android学习大纲,同时也会附上部分学习资料,主要还是希望大家能 ...
- Carson带你学Android:请收好这一份全面详细的Android学习指南
前言 如果你也学习Android,那么你大概率会看过我的文章.经常有读者给我留言:"该怎么学习Android?"."日常学习Android的方法是什么". 今天 ...
- 视觉SLAM十四讲学习笔记-第六讲学习笔记总结(1)---非线性优化原理
第六讲学习笔记如下: 视觉SLAM十四讲学习笔记-第六讲-非线性优化的状态估计问题_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习笔记-第六讲-非线性优化的非线性最小二乘问题_ ...
- 视觉SLAM十四讲学习笔记-第六讲-非线性优化的实践-高斯牛顿法和曲线拟合
专栏系列文章如下: 视觉SLAM十四讲学习笔记-第一讲_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习笔记-第二讲-初识SLAM_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习 ...
- 视觉SLAM十四讲学习笔记-第六讲-非线性优化的非线性最小二乘问题
专栏系列文章如下: 视觉SLAM十四讲学习笔记-第一讲_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习笔记-第二讲-初识SLAM_goldqiu的博客-CSDN博客 视觉SLAM十四讲学习 ...
- 微信小程序趋势及前景,详细的Android学习指南
**新技术层出不穷,去年kotlin到如今Flutter,技术迭代,你是否会变得固步自封?**那么看本篇文章帮你解决问题,让你知道怎么样学习,学习那些技术点才能不被时代的迭代快速淘汰! 首先,先说一下 ...
- 全套学习!系统学Android从零开始,详细的Android学习指南
开头 互联网时代的到来,让我们获取知识变得更加简单,理论上讲只要你想学,便会有不尽的知识等你,只要方法得当,够努力,任何人都可以都有可能成为大牛. 自己在努力的基础上,还学习了一些高效的学习方法,让我 ...
- 字节大牛耗时八个月又一力作,详细的Android学习指南
开头 互联网时代的到来,让我们获取知识变得更加简单,理论上讲只要你想学,便会有不尽的知识等你,只要方法得当,够努力,任何人都可以都有可能成为大牛. 自己在努力的基础上,还学习了一些高效的学习方法,让我 ...
最新文章
- android编译会生成class吗,请教下Android N混合编译生成的base.art中的类在运行时最终添加到哪个classloader的问题...
- 归并排序执行次数_十大排序算法,看这篇就够了
- c语言静态图片做成动态效果,如何使静态图片做成动态效果?怎么让静态图片动起来...
- 用js控制选择CheckBoxList
- 注册表在各个系统中保存路径
- 001. 为input type=text 时设置默认值
- Laravel 学习笔记之文件上传
- 易了千明之易语言套装视频教程第四套辅助制作
- Android 获取时间戳
- 电脑主板元件判断方法
- 根除文件夹exe病毒教程
- 创业者需要干掉的三种思维
- 鸡兔同笼。已知鸡兔总头数为h,总脚数为f,求鸡兔各有多少只?
- 互联网APP监控即时报警解决最终方案及总结
- 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。例如, 罗马数字 2 写做 II ,即为两个并列的 1
- 最热门的网络游戏排行榜及分析
- Win10 Version 1803 四月更新正式版 ISO 镜像下载
- 《Web安全之机器学习入门》笔记:第七章 7.6朴素贝叶斯检测DGA域名
- 【离散数学】一阶逻辑等值演算与推理
- 「自控原理」5.2 频域稳定判据、频域分析