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

  • SEARCH
  • Home
  • 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 8425405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:15:41+00:00 2026-06-10T04:15:41+00:00

I did this before. I copy-pasted. I copy-pasted many other examples from the net.

  • 0

I did this before. I copy-pasted. I copy-pasted many other examples from the net. I simply cannot make the textcolor selector work. It sets the default color to the textview, but it won’t change if you click on the textview. The settings_selector for the background works fine.

This is the layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/settings_selector"
    android:clickable="true"
    android:id="@+id/llRecentChanges"
    android:paddingTop="5dp"
    android:paddingBottom="5dp"
    android:paddingLeft="5dp">
      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/llRecentChanges2"
        android:layout_weight="1"
        android:layout_gravity="center_vertical">
    <TextView
        android:id="@+id/tvAbout"
        android:text="@string/settings_recentchanges"
        android:gravity="center_vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16dp"
        android:textColor="@drawable/settings_selector_txt" >
    </TextView>
    <TextView
        android:id="@+id/tvAbout2"
        android:text="@string/settings_recentchanges2"
        android:gravity="center_vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@drawable/settings_selector_txt"
        android:textSize="10dp">
    </TextView>
    </LinearLayout>

</LinearLayout>

This is the settings_selector_txt xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" 
          android:state_pressed="false" 
          android:color="#FFFFFF" />
    <item android:state_focused="true" 
          android:state_pressed="true"
          android:color="#ffa800" />
    <item android:state_focused="false" 
          android:state_pressed="true"
          android:color="#ffa800" />
    <item android:color="#FFFFFF" />
</selector>

or this

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_selected="true" android:color="#444"/>
    <item android:state_focused="true" android:color="#444"/>
    <item android:state_pressed="true" android:color="#444"/>
    <item android:color="#ccc"/>

</selector>

or this

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:state_pressed="false" android:color="#ffffff" />
    <item android:state_focused="true" android:state_pressed="true" android:color="#000000" />
    <item android:state_focused="false" android:state_pressed="true" android:color="#000000" />
    <item android:color="#ffffff" />
</selector>

None of them is working. Putting the selector xml to the color folder is also no solution.
Any ideas?

  • 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-10T04:15:43+00:00Added an answer on June 10, 2026 at 4:15 am

    Make sure your TextView is ready for listening the states you are applying for.
    For instance, to be able to reach the “state_pressed” your textView should be clickable:

    android:clickable="true"
    

    EDIT: There we go. This layout does the job. Note that the View that gathers the click event is the linearLayout, but the TextView reproduces it because of “duplicateParentState” set to true. The color selector would take care of the colors for the different states.

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/testLlayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:clickable="true" >
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@drawable/textview_selector"
            android:duplicateParentState="true"
            android:text="TextView" />
    
    </LinearLayout>
    

    And here is the code for the color selector.

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    
        <item android:state_selected="true" android:color="#444"/>
        <item android:state_focused="true"  android:color="#444"/>
        <item android:state_pressed="true"  android:color="#444"/>
        <item android:color="#ccc"/>
    
    </selector>
    

    That should be it.

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

Sidebar

Related Questions

I wanted to copy DOM element in variable, so I did this: var before=$(#someid).html();
I've had this before, but can't seem to replicate the steps I did back
I asked this question before but with less information than I have now. What
Sorry if answers to this question already exist, I did not find them yet.
Im working on a web project in ASP .NET MVC 2. In this project
I have to make a local copy of a remote SQL Server database. I
I have to create a fb application, I never did one before but I
I found this piece of code from anther post here. It worked as intended
This problem is bizarre. I have never encountered anything like it before. I am
How do you prevent a file descriptor from being copy-inherited across fork() system calls

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.