问题描述
我已经创建了一个名为 rounded_button.xml 的 xml 文件,用于计划在登录屏幕中使用的自定义圆形按钮设计。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorPrimaryDark"/>
<corners
android:topRighTradius="100px"
android:topLefTradius="100px"
android:bottomrighTradius="100px"
android:bottomLefTradius="100px"
/>
</shape>
我试图像这样在登录屏幕中实现它
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
tools:context=".LoginActivity">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Round"
android:background="@drawable/round_button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
但是,按钮仍然是矩形,即使我增加了拐角的大小,它也不会使边缘变圆
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)