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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:25:53+00:00 2026-06-07T20:25:53+00:00

I have a spinner in my apps. There are four items:- item1 item2 item3

  • 0

I have a spinner in my apps.
There are four items:-

item1

item2

item3

item4

I want to change background color of item1 and item4 only.

How can i set the background for these two items only.

  • 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-07T20:25:55+00:00Added an answer on June 7, 2026 at 8:25 pm

    Changing the element color

    You will need to write your own custom Adapter to do this job. getView() will be the method you are most interested in. There are lots of examples of how to write your own custom Adapter.

    Here is an example from Vogella that is really good.

    Basically do exactly what he did, change the getView() to check what item it currently is and then set the back ground color for that particular element View. He checked to see what item it was and then set an image for his ImageView. You would do the same, except change the background of your TextView.

    If you can not figure this out, let me know. I will post a very simple custom Adapter example with what you are looking for.


    Changing the Spinner color

    Use mySpinner.setBackgroundColor(int color).

    And do a check to see what value is selected in the spinner and change the color depending on what value is currently there.

    PsuedoCode

    if(mySpinner's current value == (item1||item4)) {
    
        mySpinner.setBackgroundColor(red);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a spinner with items, populated via ArrayAdapter. I want to change font
I have a Spinner.onItemSelected() method and I want to be able to have an
Hi I have a spinner for which I would like to change its entry.
I have one spinner in which few values are there from strings.xml and I
I have one spinner, one button and a ListView. I want to choose item
I have a spinner and when the user selects I want to call another
i have a spinner and i want the spinner to prompt as select class.
I have One Spinner in AlertDialog. On First look their will be only on
I have my spinner pulling from an array,(that works).. What I want to happen
I have a spinner with huge amount of items, so the simple scrolling is

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.