Android的框架布局:FrameLayout

Android的框架布局:FrameLayout,第1张

概述<?xmlversion="1.0"encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayoutxmlns:android="http://schemas.android.com/apkes/android"xmlns:app="http://schemas.android.com/apkes-auto"
<?xml version="1.0" enCoding="utf-8"?><androIDx.constraintlayout.Widget.ConstraintLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    xmlns:app="http://schemas.androID.com/apk/res-auto"    xmlns:tools="http://schemas.androID.com/tools"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    tools:context=".Layout_FrameLayout">    <FrameLayout        androID:ID="@+ID/myframe"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        tools:layout_editor_absoluteX="199dp"        tools:layout_editor_absoluteY="179dp">        <TextVIEw            androID:layout_height="200dp"            androID:layout_wIDth="200dp"            androID:background="#8F96BF"            />    </FrameLayout></androIDx.constraintlayout.Widget.ConstraintLayout>

效果

再添加一个

<TextVIEw androID:layout_height="200dp" androID:layout_wIDth="200dp" androID:background="#8F96BF" />

可以看到效果是这个样子的,感觉上是没有什么变化的,但其实是两个VIEw叠加到了一起。

我们可以把叠加的那个大小改变一下,这样就可以很清楚的看到。

<TextVIEw    androID:layout_height="100dp"    androID:layout_wIDth="100dp"    androID:background="#8F96BF"    />

tip:尽量使用dp作为空间大小的单位,sp作为文字相关大小的单位。

我们再加上<ImageVIEw    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:src="@drawable/hhh"    />
<androIDx.constraintlayout.Widget.ConstraintLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    xmlns:app="http://schemas.androID.com/apk/res-auto"    xmlns:tools="http://schemas.androID.com/tools"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    tools:context=".Layout_FrameLayout">    <FrameLayout        androID:ID="@+ID/myframe"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        tools:layout_editor_absoluteX="199dp"        tools:layout_editor_absoluteY="179dp">        <TextVIEw            androID:layout_height="200dp"            androID:layout_wIDth="200dp"            androID:background="#8F96BF"            />        <TextVIEw            androID:layout_height="100dp"            androID:layout_wIDth="100dp"            androID:background="#fff"            androID:text="西安科技大学"            androID:textcolor="#f00"            androID:textSize="20sp"            />        <ImageVIEw            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:src="@drawable/hhh"            />    </FrameLayout></androIDx.constraintlayout.Widget.ConstraintLayout>

androID:layout_gravity="right"

 

总结

以上是内存溢出为你收集整理的Android的框架布局:FrameLayout全部内容,希望文章能够帮你解决Android的框架布局:FrameLayout所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1058153.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存