title: Customized Spinner Dialog with unwanted space
body: <p>I'm creating a custom Dialog that is started by a custom spinner. What I was trying to do is customize the dialog the spinner calls. However, there is an annoying space in the dialog. I've tryied all my resources to fix it, but nothing. I also followed this <a href="https://stackoverflow.com/questions/5329272/custom-alert-dialog-getting-unwanted-padding">question</a>'s answer but didn't solve.</p>
  
  <p>In the spinner xml file I pass it like this. It references the following class named CustomSpinner, that extends a Spinner:</p>
  
  <pre><code> &lt;com.myproject.CustomSpinner
      android:id="@+id/customSpinner"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:paddingLeft="13dp"
      android:prompt="@string/my_spinner"/&gt;
  </code></pre>
  
  <p>And I have this class that is my custom dialog class:</p>
  
  <pre><code>public class CustomSpinnerDialog extends Dialog implements OnItemClickListener, View.OnClickListener
  {
      private OnItemSelectedListener onItemSelectedListener;
  
      public DialogInterface.OnClickListener mListener;
      public Context mContext;    
  
      public interface OnItemSelectedListener
      {
          public void onItemSelected(String itemValue);       
      }
  
      public CustomSpinnerDialog(Context context, CustomSpinner.SpinnerAdapter spinnerAdapter, DialogInterface.OnClickListener listener) 
      {
          super(context);     
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          this.setContentView(R.layout.custom_spinner);
          mListener = listener;
          mContext = context;
  
          ListView listView = (ListView) this.findViewById(R.id.listview);
          listView.setAdapter(spinnerAdapter);
          listView.setOnItemClickListener(this);
          listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);        
      }
  
      public void setOnItemSelectedListener(OnItemSelectedListener listener)
      {
          this.onItemSelectedListener = listener;
      }
  
      @Override
      public void onClick(View v) 
      {
          if(mListener != null)
              mListener.onClick(this, DialogInterface.BUTTON_POSITIVE);           
      }
  
      @Override
      public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) 
      {
          if(mListener != null)
              mListener.onClick(this, position);
          String text = (String) parent.getItemAtPosition(position);
          onItemSelectedListener.onItemSelected(text);        
      }
  
      public void setDialogTitle(String title)
      {
          TextView titleText = (TextView) this.findViewById(R.id.titleText);
          titleText.setText(title);
      }   
  }
  </code></pre>
  
  <p>And this is my custom spinner:</p>
  
  <pre><code>public class CustomSpinner extends Spinner implements DialogInterface.OnClickListener
  {
      public Context mContext;
      public String[] mDataList;
  
      public CustomSpinner(Context context, AttributeSet attrs) 
      {
          super(context, attrs);  
          this.mContext = context;
      }
  
      @Override
      public boolean performClick() 
      {   
          boolean handled = false;
          if (!handled) 
          {
              handled = true;                                                
  
              CustomSpinnerDialog dialog = new CustomSpinnerDialog(mContext, (ListAdapter) getAdapter(), this, R.style.FullHeightDialog);               
              dialog.setDialogTitle(mContext.getResources().getString((R.string.my_dialog_text)));                              
              dialog.show();
          }        
          return handled;
      }
  
       @Override
       public void onClick(DialogInterface dialog, int which) 
       {
           setSelection(which);        
           dialog.dismiss();
       }
  
  }
  </code></pre>
  
  <p>My Spinner is created like this in an Activity:</p>
  
  <pre><code>cSpinner= (CustomSpinner) findViewById(R.id.customSpinner);     
  cSpinner.setDataList(dataList);
  cSpinner.setTag("CustomSpinner");
  cSpinner.setOnItemSelectedListener(controller);
  </code></pre>
  
  <p>Here is a screenshot of how the dialog looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/0UnJx.png" alt="enter image description here"></p>