android 作一个图片 button

titlebar_btn_refresh_selector.xml

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

一共三种状态:按下、聚焦、不然(也就是除了前面两种状态)

而后在button的android:background=“”上引用这个xml文件
相关文章
相关标签/搜索