Android自定义按钮

1、画9.png图片

2、/drawable文件下写.xml文件设置按钮的状态:

<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_pressed="false" android:drawable="@drawable/button" />
  <item android:state_pressed="true" android:drawable="@drawable/b_pressed" />
  <item android:state_focused="true" android:drawable="@drawable/b_pressed"/> 
</selector>

3、用TextView当按钮,设置background属性,设置点击监听事件


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章