微调背景与微调项目布局

问题描述

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

    <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 (将#修改为@)