Create a button in xml like this
Although it is not ugly, we still hope to be able to control the button style ourselves in different situations.
Select res--values--themes--themes.xml, the parent is like this
Modify it to
<style name="Theme.GoodWeatherNew" parent="Theme.MaterialComponents.DayNight.Bridge">
You can change the style yourself
How to change it
Create an xml file under drawable
Select element as shape
Add code to xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
//背景颜色
<solid android:color="#5B9798" />
//设置边框线的粗细和颜色
<stroke
android:width="0dp"
android:color="@color/transparent" />
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
//角参数可以单独设置
<corners android:radius="10dp" />
</shape>
Make the following reference in your activity
android:background="@drawable/button"
You can also change the font color
Removed the original purple~