gpt4 book ai didi

android - Android中矩形圆角的最大值

转载 作者:太空宇宙 更新时间:2023-11-03 11:56:36 25 4
gpt4 key购买 nike

我试图得到如图所示的形状,一个角完全圆的矩形: enter image description here

但似乎我不能得到比这个图更“圆”的角:

enter image description here

这是为什么呢? <corners android:radius="integer" /> 有一个最大值?当然我可以用 png 来做到这一点,但我想使用形状更有效,所以我更喜欢那样。

我的代码:

<Button
android:id="@+id/button_guest"
android:layout_width="315dp"
android:layout_height="80dp"
android:background="@drawable/rounded_rectangle"
android:contentDescription="@string/text_button_guest"
android:onClick="startGuestMode"
android:text="@string/text_button_normal"
android:textAllCaps="false"
android:textColor="#ff000000"
android:textSize="50sp"
android:layout_marginLeft="125dp"
android:layout_marginStart="125dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

rounded_rectangle.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<corners
android:radius="40dp" />
</shape>

最佳答案

好吧,我喜欢挠头几个小时,然后我在这里问了一个问题,然后我在不到 10 分钟内自己找到了答案:D

解决方案在我下面的代码中。你会认为它应该有相同的行为,但显然它没有。可能是关于圆角的另一个错误。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<corners
android:bottomLeftRadius="40dp"
android:bottomRightRadius="40dp"
android:topRightRadius="40dp"
android:topLeftRadius="40dp"
/>
</shape>

关于android - Android中矩形圆角的最大值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29799933/

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