gpt4 book ai didi

android - 如何使按钮指向右侧或左侧?

转载 作者:行者123 更新时间:2023-11-29 19:42:59 25 4
gpt4 key购买 nike

我希望在我的应用程序中使用这种形状的按钮,指向右侧或左侧。

按钮的两个角是圆的,另一边是三角形。

我可以使用 png 图像作为背景来完成此操作,但我更想知道如何在 xml 中完成此操作。

enter image description here

最佳答案

不确定这样做的确切方法,但您总是可以将 topLeftbottomLeft 或 Right 的 radius 或 Right 增加到最大值, 以获得半圆形的尖端。这是我尝试过的方式

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners
android:topLeftRadius="100dp"
android:topRightRadius="31dp"
android:bottomLeftRadius="100dp"
android:bottomRightRadius="31dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#7995A8"
android:startColor="#E8E8E8"
android:endColor="#000000"
android:type="linear"
/>
<size
android:width="172dp"
android:height="60dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>

This is how it looks..

关于android - 如何使按钮指向右侧或左侧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38300396/

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