如何解决AppCompatAutoCompleteTextView在Settext Android材料设计后不显示其他下拉项目
<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="8dp"
android:hint="Gender"
app:hintTextColor="@color/secondaryColor"
app:boxStrokeColor="@color/secondaryColor">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:id="@+id/gender"
style="@style/Widget.MaterialComponents.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"
android:cursorVisible="false"
android:layout_gravity="center_vertical"/>
</com.google.android.material.textfield.TextInputLayout>
当我没有将任何文本设置为性别时,这工作正常
但我在编辑学生时使用相同的活动,然后我在编辑模式下设置性别。 但是当我在此自动完成文本下拉列表未出现后设置任何性别时
adapterGenderType = new ArrayAdapter(this,android.R.layout.simple_spinner_item,genderSpinnerArray);
adapterGenderType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mainView.gender.setAdapter(adapterGenderType);
在编辑模式下,我正在设置这样的数据
if (student.getGender() != null && !student.getGender().isEmpty()){
if (student.getGender().equals(Constants.MALE)){
mainView.gender.setText(Constants.MALE);
}else {
mainView.gender.setListSelection(1);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。