У меня есть фрагмент диалога с автозаполнением текстового представления в alertDialog.Поскольку заголовок не соответствует макету в соответствии с моим стилем, я добавил textView, чтобы показать заголовок в моем пользовательском макете.Затем я заметил, что выпадающий список из автозаполнения больше не привязывается к автозаполнению, а к заголовку textView.Изображение слева.Удаление textView решает размещение.Изображение справа.
![enter image description here](https://i.stack.imgur.com/STaE1.png)
Установка якоря с помощью android:dropDownAnchor
не решает проблему.Установка заголовка в alertDialog сохраняет пустое пространство вокруг оранжевой панели.См. этот вопрос .И удаление заголовка не вариант.Мой файл макета показан ниже:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="0dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/txt_dialogtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="@string/overlayschedulepickerdialog_title"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/ScheduleCompareDialogTitle"/>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/txt_dialogtitle"
app:layout_constraintBottom_toBottomOf="parent">
<RadioGroup
android:id="@+id/radiogroup_main_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent">
<RadioButton
android:id="@+id/radio_teachers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Docenten" />
<RadioButton
android:id="@+id/radio_locations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lokalen" />
</RadioGroup>
<RadioGroup
android:id="@+id/radiogroup_main_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="@id/radiogroup_main_left"
app:layout_constraintTop_toTopOf="@id/radiogroup_main_left">
<RadioButton
android:id="@+id/radio_students"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Leerlingen" />
<RadioButton
android:id="@+id/radio_groups"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Groepen" />
</RadioGroup>
<CheckBox
android:id="@+id/check_own_properties"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Alleen eigen leerlingen/groepen"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/radiogroup_main_right"
app:layout_constraintStart_toStartOf="@id/radiogroup_main_left" />
<RadioGroup
android:id="@+id/radiogroup_branches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/check_own_properties"
app:layout_constraintTop_toTopOf="@id/radiogroup_main_left"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="16dp"
>
</RadioGroup>
<AutoCompleteTextView
android:id="@+id/acl_textinput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:hint="Zoeknaam"
app:layout_constraintTop_toBottomOf="@id/check_own_properties"
app:layout_constraintLeft_toLeftOf="@id/check_own_properties"
android:layout_marginLeft="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="20dp"
android:dropDownHeight="150dp"
android:inputType="textNoSuggestions"/>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
Кстати, на моем реальном устройстве под управлением Nougat выпадающий список отлично привязан, но не на эмуляторе под управлением нуги или пирога.