title: how to set spinner text in center and set divider also
body: <p>I want to set a spinner text center and set a divider also. There is a problem in set text at the center and set divider.  Also the spinner items and spinner values are coming from a server json.</p>
  
  <p>This is my code:</p>
  
  <p><strong>XML:</strong></p>
  
  <pre><code>&lt;Spinner
      android:id="@+id/txtSpinner"
      android:layout_width="fill_parent"
      style="@android:style/Widget.Holo.Light.Spinner"
      android:dropDownVerticalOffset="28dp"
      android:gravity="center_horizontal"
      android:textAlignment="center"
      android:layout_height="45dp"
      /&gt;
  </code></pre>
  
  <p><strong>Java code:</strong></p>
  
  <pre><code>   private void getSpinnerData() {
      final ProgressDialog loading = ProgressDialog.show(this, "Loading Data", "Please wait...", false, false);
      loading.setCancelable(true);
      StringRequest stringRequest = new StringRequest(spinner_url,
              new Response.Listener&lt;String&gt;() {
                  @Override
                  public void onResponse(String response) {
                          loading.dismiss();
                      JSONObject j_obj = null;
                      try {
                          j_obj = new JSONObject(response);
                          result = j_obj.getJSONArray("data");
                          getdata(result);
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                  }
              });
      RequestQueue requestQueue = Volley.newRequestQueue(this);
      requestQueue.add(stringRequest);
  }
  private void getdata(JSONArray j) {
      for (int i = 0; i &lt; j.length(); i++) {
          try {
              JSONObject json = j.getJSONObject(i);
              spinnerlist.add(json.getString("category"));
          } catch (JSONException e) {
              e.printStackTrace();
          }
      }
      //Setting adapter to show the items in the spinner
      txtSpinner.setAdapter(new ArrayAdapter&lt;String&gt;(TextActivity.this, android.R.layout.simple_spinner_dropdown_item, spinnerlist));
  
  }
  </code></pre>
  
  <p><strong>current output</strong></p>
  
  <p><a href="https://i.stack.imgur.com/N94Ly.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N94Ly.png" alt="enter image description here"></a></p>
  
  <p><strong>What I want</strong></p>
  
  <p><a href="https://i.stack.imgur.com/sg88v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sg88v.png" alt="this"></a></p>