android - 使用 ArrayAdapter 关闭 Android Spinner 会丢失项目填充
问题描述
我有一个问题,如果我使用基本的 ArrayAdapter 在微调器中显示项目,如果我打开微调器,这些项目上的所有间距都会丢失,通过在其外部点击将其关闭,然后再次打开它。看起来像颜色等其他属性仍然保持不变。
这是我创建微调器的方式:
binding.fragmentTypeSpinner.setAdapter(new ArrayAdapter<>(mContext,
R.layout.item_simple_spinner,
typeArray));
item_simple_spinner.xml:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_simple_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorTransparent"
android:textSize="17sp"
android:padding="10dp" />
我也尝试了基本的 android 微调器项目布局,但仍然没有骰子。这种情况以前发生在其他人身上吗?我搜索了但想不出很多。
解决方案
推荐阅读
- react-native - 在项目“:app”中找不到任务“installDebug”
- docker - 运行 docker-compose up 时出现“拨号 unix /tmp/docker.sock:连接:权限被拒绝”
- apache - 指向 html 文件夹的两个域要重定向到子文件夹
- admob - SwiftUI 中的 Google AdMob 横幅事件集成
- pyspark - pyspark客户端模式下的Java堆空间OutOfMemoryError
- android - 如何修复 FragmentManager 已经在 FragmentTransaction 中执行事务?
- ruby-on-rails - 随机加载错误的 I18n 语言环境
- xml - 如何使用 xmlstarlet 选择多个具有相同名称的元素?
- c# - 在 WPF 中设置 MapIcon 的正确 Uri 方案是什么?
- php - 为什么默认情况下在 PLESK 中禁用 opcache_get_status