gpt4 book ai didi

安卓 XML : drawing StackOverflow's GraphicDesign's diamond/rhombus button with diamond/rhombus borders

转载 作者:行者123 更新时间:2023-11-29 16:35:38 24 4
gpt4 key购买 nike

我想使用与此按钮相同的边框:enter image description here (参见:https://graphicdesign.stackexchange.com/)。是否可以使用 radius XML 属性(borderLeftTopRadius 等)来实现?还是我必须使用一些图片?

最佳答案

只需创建一个 Drawable 资源文件:custom_button.xml

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="153.77dp"
android:height="41.33dp"
android:viewportWidth="153.77"
android:viewportHeight="41.33">

<path
android:strokeColor="#e94b5a"
android:strokeWidth="1"
android:strokeMiterLimit="10"
android:pathData="M 9.89 0.5 L 144.22 0.5 L 153.22 20.5 L 144.22 40.83 L 10.22
40.83 L 0.55 20.5 L 9.89 0.5 Z" />
</vector>

然后把它作为你按钮的背景:

 <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ask question"
android:textColor="#E94A5A"
android:background="@drawable/custom_button"/>

截图:

Screenshot

关于安卓 XML : drawing StackOverflow's GraphicDesign's diamond/rhombus button with diamond/rhombus borders,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52581815/

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