android– 图像覆盖另一个图像

android– 图像覆盖另一个图像,第1张

概述我有2个图像我想把一个图像放在另一个图像上我的xml如下<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apkes/android"android:layout_width="match_parent"android:layout_height="

我有2个图像我想把一个图像放在另一个图像上我的xml如下

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:orIEntation="vertical" ><ImageVIEw    androID:ID="@+ID/imgThumb"    androID:layout_wIDth="60dip"    androID:layout_height="80dip"    androID:layout_gravity="center_horizontal"    androID:layout_margintop="20sp"    androID:src="@drawable/bg" /><TextVIEw    androID:ID="@+ID/imgText"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_margin="5dip"    androID:ellipsize="marquee"    androID:singleline="true"    androID:text="test string"    androID:textcolor="#000000"    androID:textSize="10dip"    androID:visibility="gone" /><VIEw    androID:layout_wIDth="fill_parent"    androID:layout_height="30sp"    androID:background="@drawable/shelf" />

布局看起来像这样

我希望在第二张图像上显示第一张图像.因此看起来第一张图像位于第二张图像上

解决方法:

将linearLayout更改为relativeLayout,切换2个图像的位置.

<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent" ><VIEw    androID:ID="@+ID/shelf"    androID:layout_below="@+ID/imgThumb"    androID:layout_wIDth="fill_parent"    androID:layout_height="30sp"    androID:background="@drawable/shelf" /><ImageVIEw    androID:ID="@+ID/imgThumb"    androID:alignParenttop="true"    androID:layout_wIDth="60dip"    androID:layout_height="80dip"    androID:layout_gravity="center_horizontal"    androID:layout_margintop="20sp"    androID:src="@drawable/bg" />
总结

以上是内存溢出为你收集整理的android – 图像覆盖另一个图像全部内容,希望文章能够帮你解决android – 图像覆盖另一个图像所遇到的程序开发问题。

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

    保存