我想更改我的對話框微調框的popupBackground顏色。更改對話框微調框的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
發生,它仍然是默認的白色。
但是,如果我改變背景它的作品,但它不是對話框的背景。
https://stackoverflow.com/questions/31425697/spinner-popup-background-color-issue –
這裏閱讀:https://stackoverflow.com/questions/8922924/how-to-change-android -spinner-popupbackground –