gpt4 book ai didi

android - 在 Android 的一个 Angular 上将半径边框绘制到 imageview 或 textview

转载 作者:太空狗 更新时间:2023-10-29 16:22:43 24 4
gpt4 key购买 nike

我需要在我的应用程序中为 imageview 或 textview 绘制边框,但我只需要在一个 Angular 上绘制它,就像图像一样。

enter image description here

我做了一个形状,但我在所有 4 个边上都有边框:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1px" android:color="#FF000000" />
<solid android:color="#ffffffff"/>
<padding android:left="1px" android:top="1px"
android:right="0px" android:bottom="0px" />
<corners android:topLeftRadius="8px" />
</shape>

我怎样才能让它像图片中那样?

谢谢,马蒂亚

最佳答案

使用此代码将解决它:

<?xml version="1.0" encoding="utf-8" ?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#FF0000" />
<corners android:topLeftRadius="15dp" />
</shape>
</item>
<item android:left="10dp" android:top="10dp">
<shape android:shape="rectangle">
<solid android:color="#000000" />
<corners android:topLeftRadius="15dp" />
</shape>
</item>
</layer-list>

您还必须在(布局 Xml)中进行调整,如:

android:layout_width

android:layout_height

android:paddingTop

android:paddingLeft

这是输出:

enter image description here

希望这对您有所帮助。

关于android - 在 Android 的一个 Angular 上将半径边框绘制到 imageview 或 textview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10495265/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com