自訂button樣式
建立 them.xml <style> 將按鈕顏色設定到 android:background backgroundTint 需設為 @null 顏色才會套用 textColor 自訂文字顏色 <style name ="myNumberButton" parent ="TextAppearance.AppCompat.Button" > <item name ="android:background" > @drawable/bg_numder_button </item> <item name ="backgroundTint" > @null </item> <item name ="android:textColor" > @color/button_number_text </item> </style> drawable/bg_numder_button.xml <state_pressed = true> 按下時顯示的樣式 <state_pressed = false> 沒按下時顯示的樣式 (平時) <selector xmlns: android ="http://schemas.android.com/apk/res/android" > <item android :drawable ="@drawable/button_selected" android :state_pressed ="true" /> <item android :drawable ="@drawable/button_normal" android :state_pressed ="false" /> </selector> drawable/button_normal.xml 平時的按鈕樣式 <layer-list>圖層 (做出陰影效果) 後...