app:icon
属性指定图标。
圆角
<com.google.android.material.button.MaterialButton
android:id=“@+id/btn”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“20dp”
android:text=“@string/app_name”
android:textAllCaps=“false”
app:cornerRadius=“25dp”
app:icon=“@mipmap/ic_launcher”
app:iconGravity=“end” />
app:cornerRadius
属性指定圆角大小。
Button描边
<com.google.android.material.button.MaterialButton
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“20dp”
android:text=“@string/app_name”
android:textAllCaps=“false”
app:cornerRadius=“25dp”
app:strokeColor=“@color/black”
app:strokeWidth=“3dp” />
-
app:strokeColor
描边颜色 -
app:strokeWidth
描边宽度