展会信息港展会大全

Android Layout之AbsoluteLayout
来源:互联网   发布日期:2015-11-15 09:59:58   浏览:2629次  

导读:AbsoluteLayout,顾名思义,就是绝对位置的布局;也可以叫做坐标布局,也就是指定元素的绝对位置(或者叫绝对坐标值)。这种布局简单直接,直观性强,但是由于手机屏幕尺寸差别比较大,使...

AbsoluteLayout,顾名思义,就是绝对位置的布局;也可以叫做坐标布局,也就是指定元素的绝对位置(或者叫绝对坐标值)。这种布局简单直接,直观性强,但是由于手机屏幕尺寸差别比较大,使用绝对定位的适应性会比较差。

<?xml version = "1.0" encoding = "utf-8"?>

<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:padding="10dip">

<TextView android:id="@+id/lable"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="请输入用户名:"/>

<EditText android:id="@+id/text"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_x="100dip"

android:layout_y="20dip"/>

<Button android:id="@+id/cancel"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_x="10dip"

android:layout_y="50dip"

android:text="取消"/>

<Button android:id="@+id/ok"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_x="60dip"

android:layout_y="50dip"

android:text="确定"/>

</AbsoluteLayout>

效果如下:

如果不指定Layout_x 和Layout_y 那么默认都为0.回显示在最左上角。

作者“算法 java swing”

赞助本站

人工智能实验室

相关热词: android开发 教程

相关内容
AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港