一、button控件应用效果:
二、activity_main.xml:
<?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:backgroundTint="#D8A91B"
tools:context=".MainActivity">
<Button
android:id="@+id/but1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="10dp"