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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:55:29+00:00 2026-06-13T11:55:29+00:00

I am trying to programmatically create a Spinner using an ArrayAdapter. This is being

  • 0

I am trying to programmatically create a Spinner using an ArrayAdapter. This is being done in a closed source jar as part of an Android library project and I do not have any access to resources.

I want to know how to customize the layout and the text view that displays the spinner.

–EDIT–
Presently I am using the following code

ArrayAdapter<T> spinnerData = new ArrayAdapter<T>(this, Android.R.layout.simple_spinner_item, T[]);

spinner.setAdapter(spinnerData);

What is happening is that I cannot control the size of the fonts, colours or anything else. When I click on the spinner to select something all the options are in really small text. I want to be able to change the way it renders on screen.

  • 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-13T11:55:30+00:00Added an answer on June 13, 2026 at 11:55 am

    Just create a custom ArrayAdapter and define how the spinner textview should look in that getDropDownView method of the adapter

    public class CustomizedSpinnerAdapter extends ArrayAdapter<String> {
    
     private Activity context;
     String[] data = null;
    
     public CustomizedSpinnerAdapter(Activity context, int resource, String[] data2)
     {
         super(context, resource, data2);
         this.context = context;
         this.data = data2;
     }
      ...
    
     @Override
     public View getDropDownView(int position, View convertView, ViewGroup parent)
     {   
         View row = convertView;
         if(row == null)
         {
             //inflate your customlayout for the textview
             LayoutInflater inflater = context.getLayoutInflater();
             row = inflater.inflate(R.layout.spinner_layout, parent, false);
         }
         //put the data in it
         String item = data[position];
         if(item != null)
         {   
            TextView text1 = (TextView) row.findViewById(R.id.rowText);
            text1.setTextColor(Color.WHITE);
            text1.setText(item);
         }
    
         return row;
     }
    ...
    }
    

    and set this adapter for the spinner

    Spinner mySpinner = (Spinner) findViewById(R.id.mySpinner);
    final String[] data = getResources().getStringArray(
                R.array.data);
    final ArrayAdapter<String> adapter1 = new CustomizedSpinnerAdapter(
                AddSlaveActivity.this, android.R.layout.simple_spinner_item,
                data);
    mySpinner.setAdapter(adapter1); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm all new to Android and I'm trying to create a spinner programmatically and
I am trying to create a splitView in Android programmatically. This feature is completely
Using the OpenXML SDK, 2.0 CTP, I am trying to programmatically create a Word
I'm trying to create a button programmatically and make it visible. This is what
I'm trying to programmatically create an unordered list using the asp.net HTMLGenericControl. It properly
I'm trying to programmatically create a timeline and markers using the Visio 2010 COM
I'm trying to create a FrameLayout programmatically as follows(this view will float on the
i'm trying to create buttons programmatically on my android application depending on how many
Am trying to create a homescreen shortcut programmatically on android. So far I've been
I'm trying to programmatically create a window with my own custom OpenGL NSView as

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.