前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Android布局之绝对布局AbsoluteLayout详解

Android布局之绝对布局AbsoluteLayout详解

作者头像
砸漏
发布2020-10-26 17:53:34
2.1K0
发布2020-10-26 17:53:34
举报
文章被收录于专栏:恩蓝脚本恩蓝脚本恩蓝脚本

本文实例为大家分享了Android绝对布局AbsoluteLayout的具体代码,供大家参考,具体内容如下

1 AbsoluteLayout(绝对布局)

又可以叫做坐标布局,可以直接指定子元素的绝对位置(xy)

2 由于手机屏幕尺寸差别比较大

使用绝对定位的适应性会比较差,在屏幕的适配上有缺陷

3 AbsoluteLayout子类控件的属性

android:layout_x=”35dip” 控制当前子类控件的x位置 android:layout_y=”40dip” 控制当前子类控件的y位置

开发中不推荐使用

<?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" 

  <Button
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_x="236dp"
    android:layout_y="94dp"
    android:text="Button" / 

  <Button
    android:id="@+id/button2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_x="143dp"
    android:layout_y="166dp"
    android:text="Button" / 

  <Button
    android:id="@+id/button3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_x="33dp"
    android:layout_y="263dp"
    android:text="Button" / 
</AbsoluteLayout 

以上就是本文的全部内容,希望对大家的学习有所帮助。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-09-11 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档