title: Selected item not showing in spinner kotlin
body: <p>Below is xml declaration of spinner:</p>
  
  <pre><code>&lt;Spinner
  android:id="@+id/spnReasonActApplyLeave"
  style="@style/Widget.AppCompat.Spinner.Underlined"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_marginTop="@dimen/dimen_20_dp" /&gt;
  </code></pre>
  
  <p>Below is initialization in activity class:</p>
  
  <pre><code>var adapterReasons: LeaveReasonSpinnerAdapter ?= null    
  adapterReasons = LeaveReasonSpinnerAdapter(this,R.layout.row_reason_spinner_item, reasonList)   
   spnReasonActApplyLeave.adapter = adapterReasons
  
  spnReasonActApplyLeave.setOnItemSelectedListener(object: AdapterView.OnItemSelectedListener {
              override fun onItemSelected(parent: AdapterView&lt;*&gt;?, view: View?, position: Int, id: Long) {
                  Log.e("ApplyLeave", "Selected Reason: "+reasonList.get(position))
              }
  
              override fun onNothingSelected(parent: AdapterView&lt;*&gt;?) {
  
              }
          })
  </code></pre>
  
  <p>Below is row_reason_spinner_item xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/tvReasonRowReasonSpinner"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:textColor="@color/black"
      android:textSize="@dimen/txt_16_sp" /&gt;
  </code></pre>
  
  <p>Below is LeaveReasonSpinnerAdapter class:</p>
  
  <pre><code>public class LeaveReasonSpinnerAdapter extends ArrayAdapter&lt;LeaveReasonListPayloadDataResponse&gt; {
  
      private final LayoutInflater mInflater;
      private Context mContext;
      int layoutResourceId;
      private List&lt;LeaveReasonListPayloadDataResponse&gt; data = new ArrayList&lt;&gt;();
  
      public LeaveReasonSpinnerAdapter(Context context, int resource, ArrayList&lt;LeaveReasonListPayloadDataResponse&gt; list) {
          super(context, resource, list);
          mContext = context;
          mInflater = LayoutInflater.from(context);
          layoutResourceId = resource;
          data = list;
      }
  
      @Override
      public View getDropDownView(int position, View convertView, ViewGroup parent) {
          return createItemView(position, convertView, parent);
      }
  
      @Override
      public int getCount() {
          return data.size();
      }
  
      @Override
      public LeaveReasonListPayloadDataResponse getItem(int position) {
          return data.get(position);
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          return createItemView(position, convertView, parent);
      }
  
      private View createItemView(int position, View convertView, ViewGroup parent){
          View view = mInflater.inflate(layoutResourceId, parent, false);
  
          TextView label = (TextView) view.findViewById(R.id.tvReasonRowReasonSpinner);
  
          LeaveReasonListPayloadDataResponse offerData = data.get(position);
  
          label.setText(offerData.getReason());
          label.setTextColor(ContextCompat.getColor(mContext, R.color.black));
  //        label.setBackgroundColor(ContextCompat.getColor(mContext, R.color.black));
  
          return view;
      }
  }
  </code></pre>
  
  <p>i tried many things. i also implemented appcompatspinner but still no luck in it. when i select spinner that time i can see values in dropdown but not after selecting any item.</p>
  
  <p>There is also another issue in it. setonitemselectedlistener of that spinner is also not called.</p>
  
  <p>Below is output:
  <a href="https://i.stack.imgur.com/HdDHw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HdDHw.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/jffnK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jffnK.png" alt="enter image description here"></a></p>