title: Custom layout for Spinner item
body: <p>I have a spinner within alert dialog. I wanted to reduce padding between spinner items and hence I implemented following:</p>
  <p><strong>spinner_row.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;30dp&quot;
      android:background=&quot;#fff&quot; &gt;
  
      &lt;TextView
          android:id=&quot;@+id/tvCust&quot;
          android:layout_width=&quot;200dp&quot;
          android:layout_height=&quot;30dp&quot;
          android:gravity=&quot;left|center_vertical&quot;
          android:textColor=&quot;#000&quot;
          android:textSize=&quot;15sp&quot; /&gt;
  
      &lt;RadioButton
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;30dp&quot;
          android:layout_alignParentRight=&quot;true&quot; /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  <hr />
  <p><strong>Activity code contains following:</strong></p>
  <pre><code>spinner= (Spinner) dialog.findViewById(R.id.spinner);
  String arr[] = { &quot;1&quot;, &quot;2&quot;, &quot;3&quot; };
  ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(
  CameraActivity.this, R.layout.spinner_row, R.id.tvCust,arr);
  spinner.setAdapter(adapter);
  </code></pre>
  <hr />
  <p>Now as you can see in below screenshot, radio button is getting displayed on spinner which is actually a part of <code>spinner_row.xml</code>. Note that textview width is 200dp while spinner is only 130dp long, so that radio button should not have been displayed on spinner. How can I remove it?</p>
  <p>Also, when I click any of the spinner item, spinner pop-up doesn't get disappeared as expected.(note all 3 check-boxes are checked in spinner items list). <code>setOnItemSelectedListener</code> is not getting called on item click.</p>
  <p>Any help appreciated.</p>
  <p><img src="https://i.imgur.com/6dJfpHU.jpg" alt="screenshot" /></p>
  <h2>Edit 1</h2>
  <p>As per <strong>farrukh</strong>'s suggestion, I tried his code and following is the result.</p>
  <p><img src="https://i.imgur.com/gDW19y9.jpg" alt="screenshot" /></p>