android關於spinner按下去後的效果(不是點擊效果)

先上圖

做法就是做一個SELECTOR,但是關鍵是配置裏邊的參數。

單純設置PRESSED只能有點擊的效果

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/categoryselectbar2" android:state_window_focused="true"/>
    <item android:drawable="@drawable/categoryselectbarclicked2" android:state_checked="false"/>
    <item android:drawable="@drawable/categoryselectbar2" android:state_checked="true"/>

</selector>

要用到CHECKED和FOCUSED兩個參數

            


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