Я сделал 3 AutoCompleteTextview, но когда я заполняю его, заполняется только первый, а другой не работает.
Примечание. Я использую пользовательский AutoCompleteTextview для разрешения порога с 1 проблемой.
мой файл макета:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context=".activities.ActivityProjectInfo2Preference">
<!--toolbar-->
<include layout="@layout/toolbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/dimens_10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginTop="@dimen/_16sdp"
android:layout_marginStart="@dimen/_16sdp"
android:text="Preferences"
android:textColor="@color/colorBlack"
android:textSize="@dimen/_18ssp"
android:textStyle="bold" />
<!--User of Room-->
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dimens_16sp"
android:paddingStart="@dimen/_14sdp"
android:hint="User of Room">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/user_of_room"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<!--style preference-->
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_16sdp"
android:paddingStart="@dimen/_14sdp"
android:hint="Style Preferences">
<ctdworld.com.eid.helper.InstantAutoComplete
android:id="@+id/activity_quiz_project_info_2_style_pref_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_16sdp"
android:paddingStart="@dimen/_14sdp"
android:hint="Color Preferences">
<ctdworld.com.eid.helper.InstantAutoComplete
android:id="@+id/activity_quiz_project_info_2_color_pref_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_16sdp"
android:paddingStart="@dimen/_14sdp"
android:hint="Color Preferences">
<ctdworld.com.eid.helper.InstantAutoComplete
android:id="@+id/activity_quiz_project_info_2_finish_pref_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
мой java код:
String[] styleArray = getResources().getStringArray(R.array.entries_style_preference);
ArrayAdapter styleAdapter = new ArrayAdapter(this,
R.layout.dropdown_menu_popup_item,
styleArray);
styleAdapter.getFilter();
mStylePrefSpinner.setAdapter(styleAdapter);
String[] colorArray = getResources().getStringArray(R.array.entries_colors_preference);
ArrayAdapter colorAdapter = new ArrayAdapter(this,
R.layout.dropdown_menu_popup_item,
colorArray);
colorAdapter.getFilter();
mStylePrefSpinner.setAdapter(colorAdapter);
String[] finishArray = getResources().getStringArray(R.array.entries_finish_preference);
ArrayAdapter finishAdapter = new ArrayAdapter(this,
R.layout.dropdown_menu_popup_item,
finishArray);
finishAdapter.getFilter();
mStylePrefSpinner.setAdapter(finishAdapter);
Я попробовал один за другим, потом он начал работать, но когда я пишу код для всех из трех, только один из них работает.