1.通過shape進行轉換
效果圖 平時: 單擊時
2.設置一個button
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_selectors"/>
3.在drawable下新建shape_normal.xml和shape_pressed.xml兩個文件
4.分別打開兩個xml文件編寫代碼
5.在button_selector.xml中指定資源文件,運行即可!