微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

微调背景与微调项目布局

如何解决微调背景与微调项目布局

我想改变我的微调器的背景,因为认没有边框;所以我创建了一个形状并将其设置为背景。

    <androidx.appcompat.widget.AppCompatSpinner
                android:id="@+id/cmbNumeroDados"
                android:layout_width="130dp"
                android:layout_height="45dp"
                android:spinnerMode="dropdown"
                android:background="@drawable/shape_spinner"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toEndOf="@+id/txtNumeroDados"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

我有一个 Texview 作为项目的布局:

ArrayAdapter<Integer> arrayAdapter = new ArrayAdapter<Integer>(this.getContext(),R.layout.spinner_item,numeroDeDados);

事实证明,项目的布局显示为微调器的背景,就好像项目布局是打开前微调器的背景一样。

如果我认使用项目布局并像我一样设置微调器的背景,则不会发生这种情况,这样,保留我的背景和项目布局(我不想使用)>

ArrayAdapter<Integer> arrayAdapter = new ArrayAdapter<Integer>(this.getContext(),R.layout.support_simple_spinner_dropdown_item,numeroDeDados);

在这种情况下,它会正常工作,微调器的背景和项目的布局都不同。

在android中自定义微调器真的很痛苦。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。