Android绝对布局AbsoluteLayout Android布局之绝对布局AbsoluteLayout详解

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Android绝对布局AbsoluteLayout Android布局之绝对布局AbsoluteLayout详解

海向_起源   2021-03-29 我要评论
想了解Android布局之绝对布局AbsoluteLayout详解的相关内容吗,海向_起源在本文为您仔细讲解Android绝对布局AbsoluteLayout的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点: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>

这里写图片描述

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们