这一篇有关绝度布局的更加简单,当提及“相对”、“绝对”这两个概念时,我率先想起来的是linux 路径中的“相对路径”和“绝对路径”。
一个是相对于当前路径,从本路径跳出或者是继续进入下一集路径;另一个是从根目录“\”开始的路径。
都说IT是想通的,不知能否帮助大家理解。
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<View
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_x="200dp"
android:layout_y="200dp"
android:background="#F00"
/>
</AbsoluteLayout>
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_x="200dp"
android:layout_y="200dp"
在这里留意两种参数,一个是layout_width,layout_height设置二维图像额宽和高,另一组layout_x、layout_y设置二维图像的绝对视图的点。
显示如下:

绝度布局详解
本文深入解析了Android中绝度布局的使用方法,通过与相对路径的对比,解释了layout_x和layout_y属性如何确定视图位置,以及layout_width和layout_height如何设定视图大小。
916

被折叠的 条评论
为什么被折叠?



