安德鲁斯Selector简介
xml version="1.0" encoding="utf-8"?
> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 默認情況,item必須放在最后 --> <!-- 非觸摸模式下獲得焦點并單擊時的背景圖片 --> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/ic_launcher" /> <!-- 觸摸模式下單擊時的背景圖片--> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/ic_launcher" /> <!--選中時的圖片背景--> <item android:state_selected="true" android:drawable="@drawable/ic_launcher" /> <!--獲得焦點時的圖片背景--> <item android:state_focused="true" android:drawable="@drawable/ic_launcher" /> <item android:drawable="@drawable/button_bg_default" /> </selector>
4.android:state_active="true/false" true:表示可勾選狀態時使用,false:表示不可勾選狀態下使用 5. android:state_checkable="true/false" true:表示勾選狀態下使用。false:表示非勾選狀態使用 6.android:state_checked="true/false" true:表示勾選狀態下使用。false:表示非勾選狀態使用 7. android:state_enabled="true/false" true:表示可用狀態使用(能接收觸摸/點擊事件)。false:表示不可用狀態使用 8. android:state_window_focused="true/false" true:表示應用程序窗體有焦點時使用(應用程序在前臺),false:表示無焦點時使用注意:
1、<!-- 默認情況,item必須放在最后 -->
This item is unreachable because a previous item (item #1) is a more general match than this one ? ??
不然會出現就是說第二行item之前。不能有元素出現。假設這樣放置,會出現button一直是默認狀態。而無法獲得焦點的情況 ? ? ? ? ??
版權聲明:本文博客原創文章,博客,未經同意,不得轉載。
轉載于:https://www.cnblogs.com/mengfanrong/p/4722355.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的安德鲁斯Selector简介的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Git的GUI工具sourcetree的
- 下一篇: 天猫首页迷思之-jquery实现左侧广告