Android – xml布局作为背景

Android – xml布局作为背景,第1张

概述是否可以制作由多个图像/比例/对齐组成的xml背景? 因此,有一个复杂的drawable xml可用作 android布局的背景. 例如,这是我想要做的动态xml背景: 因此,对于我的所有不同活动,请将上面的不同布局/视图放在上面: 我知道我不能将布局设置为layout_background,但这里是我想要做的设计(根据之前的图片): <RelativeLayout xmlns:android=" 是否可以制作由多个图像/比例/对齐组成的xml背景?
因此,有一个复杂的drawable xml可用作 android布局的背景.

例如,这是我想要做的动态xml背景:

因此,对于我的所有不同活动,请将上面的不同布局/视图放在上面:

我知道我不能将布局设置为layout_background,但这里是我想要做的设计(根据之前的图片):

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:background="@drawable/background_image" >    <linearLayout        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:orIEntation="vertical" >        <relativeLayout            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:layout_weight="1" >            <ImageVIEw                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:src="@drawable/main_image" />        </relativeLayout>        <relativeLayout            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:layout_weight="2" >            <ImageVIEw                androID:layout_wIDth="wrap_content"                androID:layout_height="50dp"                androID:layout_alignParentBottom="true"                androID:layout_centerHorizontal="true"                androID:src="@drawable/footer_image" />        </relativeLayout>    </linearLayout></relativeLayout>

我看到我们可以将位图设置为可绘制的xml,但是对于缩放和对齐?
有没有更简单的方法来进行这种视觉渲染?

解决方法 您可以在动态xml背景中创建一个布局,并且可以在relativeLayout之后的所有屏幕中创建 Include
<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:orIEntation="vertical"     androID:layout_wIDth=”match_parent”    androID:layout_height=”match_parent”    androID:background="@color/app_bg"    androID:gravity="center_horizontal">    <include layout="@layout/my_dynamic_layout"/>    <relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"     androID:layout_wIDth="match_parent"     androID:layout_height="match_parent" >    ...Your layout code ...    </relativeLayout ></relativeLayout >
总结

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

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

    保存