I have a simple setup:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="#C9E44B"
tools:context=".pkgTestforend.DriverAddOptionalDataFragment">
<com.google.android.material.textfield.TextInputLayout
style="Theme.MaterialComponents.Light.Bridge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
>
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/filled_exposed_dropdown"
android:layout_width="200dp"
android:visibility="visible"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
</RelativeLayout>
I am trying making a dropdownmenu visible using the simple adapter:
MaterialAutoCompleteTextView filled_exposed_dropdown;
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
String [] randomArray = new String[3];
randomArray[0] = " test ";
randomArray[1] = " values";
randomArray[2] = " ofcourse";
ArrayList<String> items = new ArrayList<String>(Arrays.asList(randomArray));
ArrayAdapter<String> h = new ArrayAdapter(getContext(),R.layout.list_item, items);
filled_exposed_dropdown = view.findViewById(R.id.filled_exposed_dropdown);
filled_exposed_dropdown.setAdapter(h);
}
And last but not least my list_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="?attr/textAppearanceSubtitle1"
/>
</menu>
However, trying to make the dropdown visible when starting my app looks like this:
The issue is that right know I am only able to write a new item but the dropdown menu is not visible. What am I missing? Most of the code is based on the orginial material.io documentation.
