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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:46:56+00:00 2026-06-16T21:46:56+00:00

I have a spinner and I have added a custom style to spinner. Problem

  • 0

I have a spinner and I have added a custom style to spinner. Problem is when I select an item it doesnt show up on the spinner but when I use android spinner style it shows what I selected on the spinner. Is there any more coding to add to make it work? Otherwise everthing of the spinner works. I have written the app when an item is selected in spinner to show a text. These things work. But it doesnt show what I selected.

Here is my code

MyAdapter  dataAdapter3 = new MyAdapter(this, R.layout.spinner, list3);
spinner1.setAdapter(dataAdapter3);

list 3 referes a list

List<String> list3 = new ArrayList<String>();

Here is the class for custom spinner style

public class MyAdapter extends ArrayAdapter<String>
    {
      private List<String> listString = new ArrayList<String>();

      public MyAdapter(Context context, int textViewResourceId, List<String> objects) {
        super(context, textViewResourceId, objects);

      this.listString  = objects;
      }

      @Override
      public View getDropDownView(int position, View convertView,ViewGroup parent) {
            return getCustomView(position, convertView, parent);
      }

      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
            return getCustomView(position, convertView, parent);
      }

      public View getCustomView(int position, View convertView, ViewGroup parent) {

       LayoutInflater inflater=getLayoutInflater();
       View row=inflater.inflate(R.layout.spinner, parent, false);
       TextView label=(TextView)row.findViewById(R.id.textView1);
       label.setText(listString.get(position)); 

       return row;

      }
    }

please can anybody tell whether I have done any mistake here?
This is how spinner is shows when I selected item
enter image description here

  • 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-16T21:46:58+00:00Added an answer on June 16, 2026 at 9:46 pm

    I tried several days on this problem. Actually code is pretty ok. problem was in the spinner.xml file. I had added a large padding to textview. Therefore, though spinner works it is not visible the selected item on spinner. Point is I forget xml file. 😀

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

Sidebar

Related Questions

I have a spinner witch is populated from database, when I select an item
I do have a problem with IToolbarManager. I have added a combo & spinner
(Android 3.0+) How would I create a Spinner for use as an Action Item
I have spinner and code android.R.layout.simple_spinner_dropdown_item . But I get weird height like this:
Hi I have a spinner (spinner5) and whenever the user selects an item that
I have a problem integrating JQuery with JSF. I use Spin. and I have
Hi i have to develop one spinner example. list is added on spinner box:
I have a spinner set up like this: ArrayAdapter<String> states = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item,
I have a ListView in which each List item has a Spinner . I
Hello I have question about android spinner I have spinner which is populated by

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.