2013-07-08 172 views
3

我想要修改默認選擇器以將啓用和禁用的複選框使用相同的繪圖。 爲此,我想我需要覆蓋複選框選擇器。 我需要使用相同的設備專用繪圖(無自定義繪圖)。 謝謝。默認情況下,哪個選擇器設置爲複選框

+1

如果要設備特定圖形內容又是什麼需要選擇這裏? –

回答

8

以下爲複選框

<?xml version="1.0" encoding="utf-8"?> 
<!-- Copyright (C) 2008 The Android Open Source Project 

    Licensed under the Apache License, Version 2.0 (the "License"); 
    you may not use this file except in compliance with the License. 
    You may obtain a copy of the License at 

      http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
--> 

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <!-- Enabled states --> 

    <item android:state_checked="true" android:state_window_focused="false" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_on" /> 
    <item android:state_checked="false" android:state_window_focused="false" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_off" /> 

    <item android:state_checked="true" android:state_pressed="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_on_pressed" /> 
    <item android:state_checked="false" android:state_pressed="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_off_pressed" /> 

    <item android:state_checked="true" android:state_focused="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_on_selected" /> 
    <item android:state_checked="false" android:state_focused="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_off_selected" /> 

    <item android:state_checked="false" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_off" /> 
    <item android:state_checked="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_on" /> 


    <!-- Disabled states --> 

    <item android:state_checked="true" android:state_window_focused="false" 
      android:drawable="@drawable/btn_check_on_disable" /> 
    <item android:state_checked="false" android:state_window_focused="false" 
      android:drawable="@drawable/btn_check_off_disable" /> 

    <item android:state_checked="true" android:state_focused="true" 
      android:drawable="@drawable/btn_check_on_disable_focused" /> 
    <item android:state_checked="false" android:state_focused="true" 
      android:drawable="@drawable/btn_check_off_disable_focused" /> 

    <item android:state_checked="false" android:drawable="@drawable/btn_check_off_disable" /> 
    <item android:state_checked="true" android:drawable="@drawable/btn_check_on_disable" /> 

</selector> 

默認選擇,這是在定義爲btn_check.xmlsdk -> platforms -> API_VERSION -> data -> res -> drawable

+0

非常感謝... 我需要文件名。 :) –

+0

4分鐘更多...;) –

+0

是...你不能立即接受答案。 –

相關問題