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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:33:48+00:00 2026-05-29T09:33:48+00:00

I am currently working on an Android tablet application which has two fragments, a

  • 0

I am currently working on an Android tablet application which has two fragments, a list fragment and a details fragment.

I am trying to make my list similar to People and Email where when selected the item background changes and a triangle is positioned on the right hand side of the list.

I am currently having difficulties setting the background of the item selected in the list.
As I understand in the list view I should set android:listSelector to a drawable and all should work.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:paddingLeft="8dp"
>

     <ListView android:id="@id/android:list"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"               
               android:layout_weight="1"  
                android:listSelector="@drawable/selected_background"   
              />


     <TextView android:id="@id/android:empty"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:text="No data. Please check your internet connection." android:gravity="center"/>
 </LinearLayout>


<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <solid android:color="@color/hukd_orange_faded" />
</shape>

When I do this the background of the coloured item does not change until I start to scroll the list. Not only this but the background flickers and often goes back to the standard background colour.

I have looked online and it seems there is a problem with Holo.light as shown here Android list selector gets stuck when using Theme.Light
I have tried two states but the problems still exist.

  • 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-29T09:33:49+00:00Added an answer on May 29, 2026 at 9:33 am

    I have finally managed to solve this problem.

    All that was required was the following two lines

    listView = getListView();
    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    

    It now works similar to mail and people in ICS for tablets.

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

Sidebar

Related Questions

I am currently working on one android application which has C2DM implementation and I
I am currently working on an Android application which has an order form. I
I'm currently trying to get a grip on Android development and working my way
Im currently working with an API which requires we send our collection details in
I'm currently working on an Android application. I wish to have a GridView on
I am currently working on Windows with android 2.2. I am trying to create
I'm currently working on a Account Management Activity for my Android application and I'm
I'm currently working on an android application that uses a subclass of SimpleListAdapter to
I am currently working on an Android app and I am trying to connect
I'm currently working on a Wrapper for Android, Which wraps an android apk with

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.