I set a smaller text size than the default in my AutoCompleteTextView
, expecting the dropdown list of suggestions to have identical text size and font. However, clearly it is different. The suggestions list text size stayed the same while the EditBox (AutoCompleteTextView) text size was changed when I set it in the activity_main.xml
with android:textSize="15dp"
. Here is the result.
I searched for a property that might control suggestions' text size but could not find it. What is the way to ensure that all text is the same size, suggestion and editbox.
Here is the code in case it is needed.
public class MainActivity extends AppCompatActivity {
private static String [] countries = new String[] {"Vatican", "Brazil",
"Switzerland", "Angola", "Haiti", "Puerto Rico", "Germany", "Mexico",
"France", "Ireland", "India", "Australia", "Zimbabwe", "South Africa",
"Canada", "Thailand", "Japan", "Chile", "Botswana", "El Salvador", "Cuba",
"Vietnam", "Mongolia", "Morocco", "Italy", "Portugal", "Ukrain"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Set up autocomplete widget
AutoCompleteTextView countryTV = (AutoCompleteTextView) findViewById(R.id.autoCompleteQuery);
ArrayAdapter<String> countriesList = new ArrayAdapter<>(this,
android.R.layout.simple_list_item_1, countries);
countryTV.setAdapter(countriesList);
}
XML
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#eeeeee"
tools:context=".MainActivity">
<AutoCompleteTextView
android:id="@+id/autoCompleteQuery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="375dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:background="@android:color/white"
android:hint="Select Country"
android:padding="10dp"
android:textSize="15dp"
android:singleLine="true"
android:textColor="@android:color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Thanks