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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:33:13+00:00 2026-05-20T14:33:13+00:00

I’d like to learn about spinner and how to change spinner text size and

  • 0

I’d like to learn about spinner and how to change spinner text size and spinner text color.

  • 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-20T14:33:14+00:00Added an answer on May 20, 2026 at 2:33 pm

    In Android, Spinner is nothing but a combo box or list box.

    It lets you viewing multiple items and allows you to select one item from the list.

    Edit Your XML code like this

    <Spinner android:id="@+id/Spinner01"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
    

    Your Java Class code should look like this

    public class SpinnerExample extends Activity { 
       private String array_spinner[];
       @Override
       public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
         array_spinner=new String[5];
         array_spinner[0]="1";
         array_spinner[1]="2";
         array_spinner[2]="3";
         array_spinner[3]="4";
         array_spinner[4]="5";
         Spinner s = (Spinner) findViewById(R.id.Spinner01);
         ArrayAdapter adapter = new ArrayAdapter(this,
         android.R.layout.simple_spinner_item, array_spinner);
         s.setAdapter(adapter);
       }
     }
    

    The Output will look like

    enter image description here

    This site gives sample screen shot with source code
    http://www.androidpeople.com/android-spinner-example

    Generaly we can’t edit the textsize or textcolor through simple adapter,in firstxml file we declare the spinner and firstjava file we find through spinnername.findviewbyid(id).we just create the custom adapter through xml file i.e firstly we create secondxml file in which we gives our requirements like textview,images etc. ,in textview we gives the textcolor and textsize then we create customadapterfile in java and we just inflate that xml file through layout inflater in our custom adapter and finally we pass that adapter in spinner.Your custom viewing spinner is created.

    example for custom view where you set the textsize,textcolor and images also and many thing:-

    In this a contact list is made and using custom adapter we inflate below xml file in
    contactadapter file

    xml file :-

    <TextView android:text="Name:" android:id="@+id/tvNameCustomContact"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_marginLeft="10dip" android:textColor="@color/darkcherryred" 
        />
    <TextView android:id="@+id/tvNumberCustomContact" android:layout_width="wrap_content"
        android:layout_height="wrap_content"  
         android:text="Number:" android:textColor="@color/DarkGrey" android:paddingLeft="10dip"
         android:layout_below="@+id/tvNameCustomContact" 
         />
    <TextView android:text="Group:" android:id="@+id/tvGroupCustomContact"
        android:layout_width="wrap_content" android:layout_height="wrap_content" 
         android:textColor="@color/darkcherryred"   android:paddingLeft="10dip"
         android:layout_below="@+id/tvNumberCustomContact"/>
    

    custom adapter file:-

    import java.util.ArrayList;
    import android.content.Context;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.ImageButton;
    import android.widget.TextView;
    
    public class ContactAdapter extends BaseAdapter 
    {
    
    
    private ArrayList<String> name=new ArrayList<String>();
    private ArrayList<String> number=new ArrayList<String>();
    private ArrayList<String> group=new ArrayList<String>();
    
    private LayoutInflater mInflater;
    public ContactAdapter(Context context,  ArrayList<String> name,ArrayList<String> number,ArrayList<String> group1) 
    {
        this.mInflater = LayoutInflater.from(context);
        this.name=name;
        this.number=number;
        this.group=group1;
    }
    
    public int getCount() {
        return this.name.size();
    }
    
    public Object getItem(int position) {
        return position;
    }
    
    public long getItemId(int position) {
        return position;
    }
    
    public View getView(int position, View convertView, ViewGroup parent) 
    {
        final ViewHolder holder;
        if (convertView == null) 
        {
            convertView = mInflater.inflate(R.layout.contactcustomlist, null);
            holder = new ViewHolder();
            holder.Name = (TextView) convertView.findViewById(R.id.tvNameCustomContact);
            holder.Number= (TextView) convertView.findViewById(R.id.tvNumberCustomContact);
            holder.Group= (TextView) convertView.findViewById(R.id.tvGroupCustomContact);
            convertView.setTag(holder);
        } 
        else 
        {
            holder = (ViewHolder) convertView.getTag();
        }
    
    
    
    
    
        holder.Name.setText    ("Name :      "+name.get(position));
        holder.Number.setText("Numbers : "+number.get(position));
        holder.Group.setText   ("Group :      "+group.get(position));
    
    
        return convertView;
    
    }
    class ViewHolder {
        TextView Name;
        TextView Number;
        TextView Group;
    
    }
    

    }

    we assume that you create firstxml file in which spinner is defined,finally in firstjava file you just add the code for spinner where we pass the custom adapter:

    ContactAdapter contactadapter = new ContactAdapter(this, NameA, MobileA, group);//NameA,MobileA,Group is a arraylist in which we pass the values from main java file to ContactAdapter java file
    Spinner spinner= (Spinner)findviewbyid(R.id.spinnername);
    spinner.setAdapter(contactadapter);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a reasonable size flat file database of text documents mostly saved in
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.