登录后更精彩...O(∩_∩)O...
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Android里面,button按钮怎么设置圆角?
在Android中,可以通过创建一个自定义的Drawable XML文件来实现给Button设置圆角的效果。以下是创建圆角按钮的步骤:
[XML] 纯文本查看 复制代码
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="@color/your_button_color" />
<stroke android:width="2dp" android:color="@color/your_stroke_color" />
</shape>
</item>
</selector>
[Java] 纯文本查看 复制代码
<Button
android:id="@+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click me"
android:background="@drawable/rounded_button" />
现在,你的Button应该具有圆角效果了。请注意,你可能需要根据你的需求调整其他Button属性,例如 android:textSize、android:textColor 等。
from: Android里面,button按钮怎么设置圆角?_android button圆角-CSDN博客 |