带有圆角xml形状的蒙版布局

带有圆角xml形状的蒙版布局,第1张

概述我有这个LinearLayout:<LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:orientation="vertical"><ImageViewandroid:layout_width="100dp"

我有这个linearLayout:

<linearLayout    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:orIEntation="vertical">    <ImageVIEw        androID:layout_wIDth="100dp"        androID:layout_height="70dp"        androID:src="@drawable/ic_launcher"        androID:scaleType="centerCrop"/>    <TextVIEw        androID:layout_wIDth="100dp"        androID:layout_height="30dp"        androID:background="#FFD800"        androID:textcolor="@androID:color/black"        androID:gravity="center"        androID:text="Text VIEw"/></linearLayout>

我想用圆角遮盖它,如下所示:

我试图将其放置在具有Layout.xml之上的另一个布局的FrameLayout中,

但是我得到的最多是:

  

要么

我正在寻找一种使用shape.xml背景的方法,

但是边框内部是透明的,外面是白色.

我的shape.xml:

<shapexmlns:androID="http://schemas.androID.com/apk/res/androID"androID:shape="rectangle"><solID    androID:color="#FFFFFF"></solID><strokeandroID:wIDth="2dp"androID:color="#000000" ></stroke><padding    androID:left="5dp"    androID:top="5dp"    androID:right="5dp"    androID:bottom="5dp"></padding><corners    androID:radius="50dp"></corners></shape>

解决方法:

创建一个九边形,其外部带有白色的圆角,中间是透明的(“反九边形”),并将其放在linearLayout的顶部.这是一种常见的做法.

总结

以上是内存溢出为你收集整理的带有圆角xml形状蒙版布局全部内容,希望文章能够帮你解决带有圆角xml形状的蒙版布局所遇到的程序开发问题。

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

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

原文地址: https://outofmemory.cn/web/1077838.html

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

发表评论

登录后才能评论

评论列表(0条)

保存