У меня есть AutoCompleteTextView, и он хорошо работает с выпадающим списком. Я хочу показать выпадающий список как часть макета в AutoCompleteTextView, а не поверх макета. Вот макет
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="@color/year_tablayout"
android:layout_below="@+id/top_menu"
android:background="@color/year_tablayout"
app:tabIndicator="@null"
app:tabMode="scrollable">
</com.google.android.material.tabs.TabLayout>
<AutoCompleteTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/autocomplete_city"
android:layout_width="match_parent"
android:background="@null"
android:hint="Search Here ..."
android:completionThreshold="0"
android:textColorHint="#aaa"
android:paddingLeft="@dimen/_10sdp"
android:textCursorDrawable="@drawable/cursor"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_search_black_24dp"
android:paddingRight="10dp"/>
<com.proj.www.ui.mainpage.NonSwipeableViewPager
android:id="@+id/viewPager_city"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/top_menu"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@color/tumblr_white"
/>
</LinearLayout>
, а вот фрагмент кода
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.city_fragment, container, false);
AutoCompleteTextView autoCity = view.findViewById(R.id.autocomplete_city);
String[] city = getResources().getStringArray(R.array.city_array);
ArrayAdapter<String> autoAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, city);
autoCity.setAdapter(autoAdapter);
}}
Я хочу сделать выпадающий список, поскольку представление принадлежит макету и отображается под AutoCompleteTextView. Заранее спасибо.