Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8501065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:06:28+00:00 2026-06-11T01:06:28+00:00

<selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:drawable=@drawable/key /> <item android:state_pressed=true android:drawable=@drawable/key_pressed /> <item android:state_checkable=true android:drawable=@drawable/key_function /> <item

  • 0
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/key" />
<item
android:state_pressed="true"
android:drawable="@drawable/key_pressed" />
<item
android:state_checkable="true"
android:drawable="@drawable/key_function" />
<item
android:state_checkable="true"
android:state_pressed="true"
android:drawable="@drawable/key_pressed" />
<item
android:state_checkable="true"
android:state_checked="true"
android:drawable="@drawable/key_function" />
<item
android:state_checkable="true"
android:state_checked="true"
android:state_pressed="true"
android:drawable="@drawable/key_pressed" />
</selector>

test result:

normal key ->@drawable/key

normal key pressed ->@drawable/key_pressed

Sticky key->@drawable/key_function

Sticky key pressed ->@drawable/key_function <—here is the problem

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:06:29+00:00Added an answer on June 11, 2026 at 1:06 am

    The selection is not based on the “best match,” but simply the first
    item that meets the minimum criteria of the state.

    http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

    So it’s the wrong drawable because one of those states is matching the current state

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

    Try to put

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

    at the top or add criterias to the previous cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a drawable like this: <selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:state_pressed=true android:state_window_focused=true android:drawable=@drawable/seek_thumb_pressed /> <item
my source selector <selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:drawable=@drawable/button_pressed android:state_focused=true android:state_pressed=true></item> <item android:drawable=@drawable/button_selected android:state_activated=true></item> <item android:drawable=@drawable/button_normal></item>
This is my custom selector (StateListDrawable) <selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:drawable=@drawable/common_cell_background /> <item android:state_pressed=true android:drawable=@drawable/common_cell_background_highlight
<?xml version=1.0 encoding=utf-8?> <selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:state_pressed=true android:color=#ff0000/> <item android:state_focused=true android:color=#0000ff/> <item android:color=#00ff00/> </selector>
I have this Selector defined: <selector xmlns:android=http://schemas.android.com/apk/res/android> <!-- PRESSED --> <item android:state_pressed=true android:drawable=@drawable/backarrow_blueshiny />
<?xml version=1.0 encoding=utf-8?> <selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:state_pressed=true android:drawable=@drawable/tab_profile_pressed_mdpi /> <item android:drawable=@drawable/tab_profile_unselected_mdpi /> </selector> And
I have a drawable selector(home_button.xml) for a button, like... <selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:state_pressed=false android:drawable=@drawable/blue_button
we wanna use png-images as background in a selector: <selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:state_focused=true android:drawable=@drawable/inputfield_text_bg_active
I have styles <resources xmlns:android=http://schemas.android.com/apk/res/android> <style name=TextStyle > <item name=android:textSize>8sp</item> <item name=android:textColor>#0A0A0A</item> <item name=android:typeface>serif</item>
I have made a XML file: <?xml version=1.0 encoding=utf-8?> <selector xmlns:android=http://schemas.android.com/apk/res/android> <item android:state_pressed=true android:drawable=@drawable/calender_h

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.