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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:32:59+00:00 2026-06-17T07:32:59+00:00

I am implementing ListView with android:listSelector <style name=ListView parent=@android:style/Widget.ListView> <item name=android:cacheColorHint>@color/transparent</item> <item name=android:divider>@drawable/divider</item> <item

  • 0

I am implementing ListView with android:listSelector

<style name="ListView" parent="@android:style/Widget.ListView">
    <item name="android:cacheColorHint">@color/transparent</item>
    <item name="android:divider">@drawable/divider</item>
    <item name="android:dividerHeight">1px</item>
    <item name="android:listSelector">@color/red</item>
</style>

Selecting works fine, but when I start scrolling, listSelector will randomly hang to top or bottom of ListView. I would appreciate any help.

Hanged listSelector

  • 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-17T07:33:00+00:00Added an answer on June 17, 2026 at 7:33 am

    The main problem is that you are using a solid color instead of using Drawables. It is a drawback in the layout framework that if you set the solid colors, then the problem of hold occurs.

    The code which you are using as :

    <item name="android:listSelector">@color/red</item>
    

    should be used as :

        <item name="android:listSelector">@drawable/list_view_selector</item> 
    

    The above written drawable should be enclosed in the selector tag.

    Here is the code for the list_view_selector

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android" >
        <item android:state_enabled="true" 
         android:state_pressed="true" android:drawable="@drawable/background_selected" />
        <item android:state_enabled="true"
         android:state_focused="true" android:drawable="@drawable/background_selected" />
        <item android:state_enabled="true"
         android:state_selected="true" android:drawable="@drawable/background_selected" />
    
    </selector>
    

    Note : You cannot use the solid color as it is. You have to make the selectors for the each color tone as :

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle" >
    
        <gradient
            android:angle="90"
            android:centerColor="#ff0000"
            android:endColor="#ff0000"
            android:startColor="#ff0000" />
    
    </shape>
    

    I have checked this at my end. Working Perfect!!

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

Sidebar

Related Questions

I am currently implementing a multi-select ListView for my android app. My aim is
I am implementing pagination for ListView in Android . I am extending the BaseAdapater
I am having a bit of difficulty implementing the android-pulltorefresh widget by Johan Nilsson
I'm implementing an Android activity. I am using a ListView in my application layout,
i am implementing custom listview in android with image, text and date but when
This problem is discussed in this question Android: Wrong item checked when filtering listview
I am implementing listview with 2 textviews , and for reference used Basic Layout
I am currently implementing a ListView populated with CheckedTextViews and have everything working just
I am implementing a ListView using custom adapters. To improve the performance I am
I am implementing a custom control which derives from ListView. I would like for

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.