0
  • 最佳答案
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:drawable="@drawable/music_pause_normal" />
        <item android:drawable="@drawable/music_pause_press" android:state_pressed="true" />
        <item android:drawable="@drawable/music_pause_press" android:state_focused="true" />
        
    </selector>
    
    


    天猫盒子上的APP 遥控移动到上面应该是focused状态吧;按一下才是pressed状态吧!

    试试上面这个应该没问题;




    1248953792351703040  评论     打赏       嗯哼
    • SoBenson  回复 @嗯哼
      没效果,就是想鼠标移上去之后就一个效果选中或者什么样的
      SoBenson 2020-10-30 13:54   回复 1316551143870029824
    • 嗯哼  回复 @SoBenson
      鼠标移上去得加上 <item android:drawable="@drawable/music_pause_press" android:state_hovered="true" />
      嗯哼 2020-10-30 14:58   回复 1248953792351703040
  • 文字都认识,就是不知道合起来表达什么

    1139423796017500160  评论     打赏       断点-含光君
    • <selector xmlns:android="http://schemas.android.com/apk/res/android">
          <item android:drawable="@drawable/music_pause_press" android:state_pressed="true" />
          <item android:drawable="@drawable/music_pause_normal" />
      </selector>
      


      选中state_pressed="true"
      


      不选中不写

      1262662471676645376  评论     打赏       我不是乘树猿
      • selector我记得选中状态必须写在前面

        1257956539327582208  评论     打赏       Dylan
        • Dylan  回复 @Dylan
          <item android:drawable="@mipmap/player_pause" android:state_selected="true"/> <item android:drawable="@mipmap/player_play"/>
          Dylan 2020-10-27 09:42   回复 1257956539327582208
      • 你selector的第二条怎么设置的是pressed?照你这样说的意思不应该也是focused?

        1247069679944470528  评论     打赏       lxxxx9
        相关问题
        幻影~ · 提问
        2024-04-13 20:13 10 2
        幻影~ · 找工作
        2024-04-07 10:44 16 2
        幻影~ · 问题
        2024-03-31 17:20 7 2
        TONYGFX · AOSP
        2024-03-28 17:11 4 2