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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:02:01+00:00 2026-06-12T22:02:01+00:00

How do I set the background color or image of a cell in a

  • 0

How do I set the background color or image of a cell in a ListView (or ListActivity) on Android?

This is a very simple ListView with just a few items in it and no other customization. I don’t want to change the text or text color or size or anything like that, I just want to change the color or background image of the cells in the ListView.

What is the simplest way to do this in code (not layout XML)?

Here is the code I am using in my ListActivity:

listitems.add("1");
listitems.add("2");
listitems.add("3");

this.getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);

setListAdapter(new ArrayAdapter<String>(
    this, 
    android.R.layout.simple_list_item_checked, 
    listitems
));
  • 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-12T22:02:03+00:00Added an answer on June 12, 2026 at 10:02 pm

    Thanks to newbyca for leading me in the right direction. This is what I was looking for and is actually the best answer as it’s the easiest code to implement:

    setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, listitems) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View v = super.getView(position, convertView, parent);
            //v.setBackgroundColor(0xffff0000);  // COLOR
            v.setBackgroundResource(R.drawable.plaincell); // IMAGE
            return v;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hav a option to set background image or color to cell. How can I
I'm trying to set the background color of a UIImageView with this (It should
I have a table cell in which i have to set a background image,
Although this seems like a simple task, I need to change the background color
I created my UITableViewCellStyleDefault styled cell and set its background image: cell.backgroundView = imgView;
I am working with list view in android. I want to set background color
I want to develop UINavigationBar and also set background color for that. I have
LaTeX newbie here. I need to set background color for all my \subsection titles.
I want to set the background color of a label using HSV instead of
I tried to set the background color of a data grid view to be

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.