2015年5月28日 星期四

[Android] layout 圖片點擊切換 xml 設計

圖片點擊切換,由xml 的方式設計

layout
1
2
3
4
5
        <ImageView
            android:id="@+id/imgListChartSwitch"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:src="@drawable/btn_measure" />


btn_measure.xml
1
2
3
4
5
6
7
xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/btn_chart" android:state_pressed="true" android:state_selected="true"/> <item android:drawable="@drawable/btn_chart" android:state_selected="true"/> <item android:drawable="@drawable/btn_list" android:state_pressed="true"/> <item android:drawable="@drawable/btn_list"/> </selector>

沒有留言:

張貼留言