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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:53:44+00:00 2026-05-25T00:53:44+00:00

How we set ListView’s background for particular row. ListView list = getListView(); sd =

  • 0

How we set ListView’s background for particular row.

    ListView list = getListView();
     sd = new SimpleAdapter(this, routhPath, R.layout.route_path,new String[] {"routeCode","routeName","outlets" },new int[] { R.id.routeCode,R.id.routeName,R.id.outlets});
     list.setAdapter(sd);
     list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
     list.setSelected(true);
     list.setTextFilterEnabled(true);
     list.setItemsCanFocus(true);
     list.setSelectionAfterHeaderView();

     if(isVisitedToVisitHeader()){
         if(defaultRoutePos != 0){
            Log.i("-----" ,"---defaultRoutePos---" + defaultRoutePos +" --count-- "+list.getChildCount());
             list.setItemChecked(defaultRoutePos, true);
            // list.getChildAt(positions).setBackgroundColor(R.color.red);
             //list.getChildAt(defaultRoutePos).setBackgroundColor(R.color.red);
         }
     }

this is my code .I have done using SimpleAdapter.Here list.getChildCount() give 0.This part I am ding in the onCreate() .

Please help me…

Thanks in advance

  • 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-25T00:53:45+00:00Added an answer on May 25, 2026 at 12:53 am

    Checkout this example of Custom ListView,

    Example

    Also this answer of StackOverflow

    StackOverflow Answer

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

Sidebar

Related Questions

I have the following problem. The background color in a ListView is set LightGreen
I have a ListView control on my form set up like this in details
I'm currently able to set a listview style VIA the ListView_SetExtendedListViewStyle method, however this
I want to set an background to my listview that have different size (depending
Hi i want to set different images to each row of a listview which
I try to set text of ListView in center of layout. I use LinearLayout
When I add new values to a listview using : Set lstView = ListView(0).ListItems.Add(,
I have a ListView and set a SimpleAdapter to show some formated items, then
I have Created a ListView and set a background image.Everything goes fine except I
I have a ListView that I set it's ItemsSource to list all the Assignments

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.