title: How to Use MaterialAutoCompleteTextView with Completion Threshold
body: <p>I'd like to start using material components in my Android app, and I am having a bit of trouble with the <code>MaterialAutoCompleteTextView</code>. I want it to behave like a standard AutoCompleteTextView, and I prefer the <code>OutlinedBox</code> style. Furthermore, it should observe the <code>completionThreshold</code> property, expanding the dropdown only after three matching characters are entered.</p>
  <p>There are four styles available for this component that are creating an outlined box:
  <code>Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu</code>
  <code>Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu</code>
  <code>Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense</code>
  <code>Widget.MaterialComponents.TextInputLayout.OutlinedBox</code></p>
  <p>However, the first two styles do not observe the <code>completionThreshold</code> and expand the dropdown immediately when they are in focus. The remaining ones seem broken and are probably not meant to be used with this component.</p>
  <p>One option obviously is to use one of the latter styles and modify it. But this could end up a bit messy for this relatively complex component, and it seems a rather hacky way to make use of a built-in behavior.</p>
  <p>What would be the right approach?</p>
  <p><a href="https://i.stack.imgur.com/U6Zwdm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U6Zwdm.png" alt="enter image description here" /></a></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;
      android:orientation=&quot;vertical&quot;
      android:layout_margin=&quot;10dp&quot;&gt;
  
      &lt;com.google.android.material.textfield.TextInputLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;10dp&quot;
          android:hint=&quot;Option 1&quot;
          app:helperText=&quot;OutlinedBox.Dense.ExposedDropdownMenu&quot;
          style=&quot;@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu&quot;&gt;
  
          &lt;com.google.android.material.textfield.MaterialAutoCompleteTextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:completionThreshold=&quot;3&quot;
              /&gt;
  
      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
      &lt;com.google.android.material.textfield.TextInputLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;10dp&quot;
          android:hint=&quot;Option 2&quot;
          app:helperText=&quot;OutlinedBox.ExposedDropdownMenu&quot;
          style=&quot;@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu&quot;&gt;
  
          &lt;com.google.android.material.textfield.MaterialAutoCompleteTextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:completionThreshold=&quot;3&quot;
              /&gt;
  
      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
      &lt;com.google.android.material.textfield.TextInputLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;10dp&quot;
          android:hint=&quot;Option 3&quot;
          app:helperText=&quot;OutlinedBox.Dense&quot;
          style=&quot;@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense&quot;&gt;
  
          &lt;com.google.android.material.textfield.MaterialAutoCompleteTextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:completionThreshold=&quot;3&quot;
              /&gt;
  
      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
      &lt;com.google.android.material.textfield.TextInputLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;10dp&quot;
          android:hint=&quot;Option 4&quot;
          app:helperText=&quot;OutlinedBox&quot;
          style=&quot;@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox&quot;&gt;
  
          &lt;AutoCompleteTextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:completionThreshold=&quot;3&quot;
              /&gt;
  
      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>