【发布时间】:2019-06-20 20:42:57
【问题描述】:
我想更改对话框微调器的 popupBackground 颜色。
在我的activity.xml:
<Spinner
android:id="@+id/mCategorySpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/textView7"
android:entries="@array/recipeCategory"
android:spinnerMode="dialog"
android:popupBackground="@color/colorPrimary"
android:textAlignment="center" />
在我的activity.java:
categorySpinner=(Spinner) findViewById(R.id.mCategorySpinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.recipeCategory, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
categorySpinner.setPrompt("Choose category");
categorySpinner.setAdapter(new NothingSelectedSpinnerAdapter(
adapter,
R.layout.category_spinner_row_nothing_selected,
this));
如果我在 XML 中更改 android:popupBackground,则不会发生任何事情,它仍然是默认的白色。
但是,如果我更改背景,它会起作用,但它不适用于对话框的背景。
【问题讨论】: