title: Is it possible to add a serchable option to an existing custom spinner?
body: <p>So basically the title says it. I am going to try and put the code in and it would be nice if i could get an answer.</p>
  <p>SecondFragment.</p>
  <pre><code>override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
  ): View? {
      // Inflate the layout for this fragment
      return inflater.inflate(R.layout.fragment_second, container, false)
  }
  
  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
      super.onViewCreated(view, savedInstanceState)
  
      view.findViewById&lt;Button&gt;(R.id.button_second).setOnClickListener {
          findNavController().navigate(R.id.action_SecondFragment_to_FirstFragment)
  
  
  
  
              }
  
  
  
      val spinner04 = view.findViewById&lt;AppCompatSpinner&gt;(R.id.spinner04)
      val modelList: List&lt;Model&gt; = readFromAsset()
      val customDropDownAdapter = CustomDropDownAdapter(requireContext(), modelList)
      spinner04.adapter = customDropDownAdapter
  
      }
  
  private fun readFromAsset(): List&lt;Model&gt; {
      val file_name = &quot;android_version.json&quot;
  
      val bufferReader = requireActivity().application.assets.open(file_name).bufferedReader()
  
      val json_string = bufferReader.use {
          it.readText()
      }
      val gson = Gson()
      val modelList: List&lt;Model&gt; = gson.fromJson(json_string, Array&lt;Model&gt;::class.java).toList()
      return modelList
  }
  }
  </code></pre>
  <p>Spinner in fragmentsecond.xml</p>
  <pre><code>&lt;androidx.appcompat.widget.AppCompatSpinner
      android:id=&quot;@+id/spinner04&quot;
      android:layout_width=&quot;365dp&quot;
      android:layout_height=&quot;69dp&quot;
      android:layout_marginBottom=&quot;292dp&quot;
      app:layout_constraintBottom_toTopOf=&quot;@+id/button_second&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintHorizontal_bias=&quot;0.531&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot; /&gt;
  
  &lt;TextView
      android:id=&quot;@+id/textView&quot;
      android:layout_width=&quot;245dp&quot;
      android:layout_height=&quot;31dp&quot;
      android:layout_marginTop=&quot;172dp&quot;
      android:text=&quot;Izaberite zemlju&quot;
      android:textSize=&quot;24sp&quot;
      app:layout_constraintBottom_toTopOf=&quot;@+id/spinner04&quot;
      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
      app:layout_constraintHorizontal_bias=&quot;0.614&quot;
      app:layout_constraintStart_toStartOf=&quot;parent&quot;
      app:layout_constraintTop_toTopOf=&quot;parent&quot;
      app:layout_constraintVertical_bias=&quot;0.034&quot; /&gt;
  </code></pre>
  <p>custom_spinner_item.xml</p>
  <pre><code> &lt;ImageView android:layout_width=&quot;40dp&quot;
      android:layout_height=&quot;40dp&quot;
      android:id=&quot;@+id/img&quot;
      android:contentDescription=&quot;@string/app_name&quot;/&gt;
  
  &lt;TextView android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:textSize=&quot;20sp&quot;
      android:paddingStart=&quot;10dp&quot;
      android:layout_gravity=&quot;center_vertical&quot;
      android:id=&quot;@+id/text&quot;
      android:paddingLeft=&quot;10dp&quot; /&gt;
  </code></pre>
  <p>I can show the CustomAddapterCode as well if needed. The thing is i am tryng to implement a search option in the spinner but i hope that i don`t need to make a new spinner. So any suggestions?</p>
  <p><a href="https://i.stack.imgur.com/IN9Hw.png" rel="nofollow noreferrer">You can take a look what i would like is to place that option either at Izaberite zemlju or at the actual Spinner that`s how it looks.</a></p>
  <p>CustomDropDownAdapter</p>
  <pre><code>private val inflater: LayoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
  
  override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
  
      val view: View
      val vh: ItemHolder
      if (convertView == null) {
          view = inflater.inflate(R.layout.custom_spinner_item, parent, false)
          vh = ItemHolder(view)
          view?.tag = vh
      } else {
          view = convertView
          vh = view.tag as ItemHolder
      }
      vh.label.text = dataSource.get(position).name
  
      val id = context.resources.getIdentifier(dataSource.get(position).url, &quot;drawable&quot;, context.packageName)
      vh.img.setBackgroundResource(id)
  
      return view
  }
  
  override fun getItem(position: Int): Any? {
      return dataSource[position];
  }
  
  override fun getCount(): Int {
      return dataSource.size;
  }
  
  override fun getItemId(position: Int): Long {
      return position.toLong();
  }
  
  private class ItemHolder(row: View?) {
      val label: TextView
      val img: ImageView
  
      init {
          label = row?.findViewById(R.id.text) as TextView
          img = row?.findViewById(R.id.img) as ImageView
      }
  }
  </code></pre>
  <p>}</p>