第一種 簡單
- style=”?android:attr/borderlessButtonStyle”
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"
style="?android:attr/borderlessButtonStyle" />
第二種 簡單
- style=”@style/Widget.AppCompat.Button.Borderless”
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"
style="@style/Widget.AppCompat.Button.Borderless" />
第三種 自定義style (可複用)
- 自定義樣式,如背景顏色,文字顏色,圓角等
- 圓角button 原生自帶陰影效果影響很大
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"
style="@style/MyButtonStyle" />
<style name="MyButtonStyle" parent="@style/Widget.AppCompat.Button.Borderless">
<!--自定義屬性-->
</style>