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 6005197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:21:59+00:00 2026-05-23T01:21:59+00:00

I have a table row and I tried many things to change its color

  • 0

I have a table row and I tried many things to change its color when it’s focused, but it never changes color when focused. Is there any way to do this? I tried this also which changed color on click but only when its’ focused:

r.setOnTouchListener(new OnTouchListener() {
    public boolean onTouch(View arg0, MotionEvent arg1) {
        if(arg0.isFocused())
        {
            arg0.setBackgroundColor(Color.BLUE);
            //arg0.isFocused();
        }
        return false;
}});
  • 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-05-23T01:22:00+00:00Added an answer on May 23, 2026 at 1:22 am

    You need to set the background color of your row to a state list drawable (that handles select, pressed, active, non-active).

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

        <?xml version="1.0" encoding="utf-8"?> 
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <!--  Active state --> 
        <item android:state_selected="true" android:state_focused="false" android:state_pressed="false" android:drawable="@android:color/transparent" />     
    <!--  Inactive state--> 
        <item android:state_selected="false" android:state_focused="false"         android:state_pressed="false" android:drawable="@android:color/transparent" />
         <!--  Pressed state-->
         <item android:state_pressed="true" android:drawable="@android:color/yellow" /> 
        <!--  Selected state (using d-pad) -->
         <item android:state_focused="true" android:state_selected="true"         android:state_pressed="false" android:drawable="@android:color/yellow" />
     </selector> 
    

    try these links too, for ur problem

    http://www.gersic.com/blog.php?id=56

    http://developer.android.com/guide/topics/ui/themes.html

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

Sidebar

Related Questions

I have tried many ways of executing this but its not happening .. here
I have tried many things, but I'm still not getting this to work. Here's
My table has many row that have a same column. I'll call the column
I have tried so many things to make this work and I have failed
I have a table row, and within that, I have a td (whatever it
I have a table row with 4 columns on my ecommerce site and I
I have a table row that needs to be hidden when the anchor with
I have a table row that has the error message in it. <tr runat=server
I have made a table row draggable with jQuery. It works as expected (mostly)
I have created a table layout in which my table row height is too

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.