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

  • Home
  • SEARCH
  • 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 8175983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:58:46+00:00 2026-06-06T22:58:46+00:00

I do this in a spinner //the text is aligned to center https://i.stack.imgur.com/GE8aG.png but

  • 0

I do this in a spinner

//the text is aligned to center

https://i.stack.imgur.com/GE8aG.png

but i would like to achieve this

//the text is aligned to left

https://i.stack.imgur.com/FTjhs.png

how could I do? I tried using the “gravity” but does not work

java code:

void addProvinceSpinner() {

    ArrayList<String> listaProvince = new ArrayList<String>();
    listaProvince.add("MILANO");
    listaProvince.add("ROMA");
    listaProvince.add("BARI");

    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
            R.layout.layout_riga_spinner_inserzionisti,
            R.id.inserzionisti_txt_riga_spinner, listaProvince);

    spinner_province.setAdapter(dataAdapter);
}

xml code (R.layout.layout_riga_spinner_inserzionisti):

<TextView
    android:id="@+id/inserzionisti_txt_riga_spinner"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:textColor="#01a0d1"
    android:textSize="20sp" />

main xml code:

<Spinner
    android:id="@+id/inserzionisti_spinner_province"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/inserzionisti_spinner_bg"
    android:prompt="@string/inserzionisti_prompt"/>

I just solved…

i had to set

android:layout_width=”wrap_content”

to

android:layout_width=”fill_parent”

in Spinner…

Thanks for all! <3

  • 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-06T22:58:47+00:00Added an answer on June 6, 2026 at 10:58 pm
    Create an xml -  raw.xml and put this code:
    
    
    <?xml version="1.0" encoding="utf-8"?>
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/spinnerTarget"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center" // As per your requirement (left, center , right etc)
    android:textColor="#454545"
    android:padding="5dip"
    android:textSize="14dip" />
    
    In class file use like this:
    
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
                this, R.array.im_arrays, R.layout.row_spiner);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This article about php form security: http://nedbatchelder.com/text/stopbots.html ... mentions a spinner as: The spinner
I have a spinner in which I would like to have the text of
this is my first question in here, and I would like to ask if
I have a input type like this: <input name=adult-count type=text data-perunit=2500 data-maxunits=5 class=up-down-spinner value=0>
I want to make a spinner controll in my page,I tried it like this:
i am using spinner in some application in spinner item list array this text
By default there is a text that comes up on a spinner control... .this
I have a custom spinner layout with an image and a text view but
I need to customize my android spinner. For this I created this spinner_selector.xml :
I created a Loading spinner in a SWF. I display this spinner in my

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.