Xml文件  |  92行  |  3.7 KB

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->

<!-- StateListDrawable used for toggle buttons in the in-call onscreen touch UI. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- TODO: For now, we spell out every possible combination of
         checked/focused/enabled/pressed here, since the assets were
         created that way.
         But instead, consider using a <layer-list> here so that the
         background and the "toggle" indicator can be separate drawables.
         That way, only the background drawable needs to care about the
         focused/enabled/pressed state, and only the toggle indicator
         needs to care about the "checked" state.  This would reduce the
         number of separate image assets we need by almost half.  (See
         btn_toggle_bg.xml in the framework for an example of this
         design.) -->

    <!-- "checked" states -->

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

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

    <item android:state_pressed="true" 
        android:state_checked="true"
        android:drawable="@drawable/btn_in_call_switch_on_pressed" />

    <item android:state_focused="true" android:state_enabled="true"
        android:state_checked="true"
        android:drawable="@drawable/btn_in_call_switch_on_selected" />

    <item android:state_enabled="true"
        android:state_checked="true"
        android:drawable="@drawable/btn_in_call_switch_on_normal" />

    <item android:state_focused="true"
        android:state_checked="true"
        android:drawable="@drawable/btn_in_call_switch_on_disable_focused" />

    <item
        android:state_checked="true"
        android:drawable="@drawable/btn_in_call_switch_on_disable" />

    <!-- "unchecked" states -->

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

    <item android:state_window_focused="false" android:state_enabled="false"
        android:state_checked="false"
        android:drawable="@drawable/btn_in_call_switch_off_disable" />

    <item android:state_pressed="true" 
        android:state_checked="false"
        android:drawable="@drawable/btn_in_call_switch_off_pressed" />

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

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

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

    <item
        android:drawable="@drawable/btn_in_call_switch_off_disable" />

</selector>