Android 如何更改微调器提示背景?
当我开发android应用程序时,我想在哪里更改微调器提示的背景颜色和文本颜色?Android 如何更改微调器提示背景?,android,Android,当我开发android应用程序时,我想在哪里更改微调器提示的背景颜色和文本颜色? 谢谢 要更改文本颜色和样式: 制作xml布局微调器。\u text.xml包含: <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center"
谢谢 要更改文本颜色和样式: 制作xml布局微调器。\u text.xml包含:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:textSize="18sp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:textColor="@android:color/black" />
然后在类中设置ArrayAdapter以使用它:
Spinner yourSpinner = (Spinner) findViewById(R.id.spinnerID);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), R.layout.spinner_text, yourStingArray);
yourSpinner.setAdapter(adapter);
Spinner yourSpinner=(Spinner)findViewById(R.id.spinnerID);
ArrayAdapter=新的ArrayAdapter(getActivity(),R.layout.spinner\u text,yourStingArray);
yourSpinner.setAdapter(适配器);
要更改xml中的微调器背景,请执行以下操作:
<Spinner
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="@+id/sCategory"
android:entries="@array/angleList"
android:background="@drawable/spinner_shape"
android:layout_marginBottom="10dp"
android:popupBackground="@drawable/spinner_shape" />
在drawable:spinner_形状中,您可以做任何需要的事情
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorFour" />
<stroke
android:color="@color/colorTwo"
android:width="2dp" />
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="4dp" />
android:popupBackground将显示drop items列表
android:background将做微调器外观我在这里没有看到问题
我想更改微调器提示背景颜色
这是一个语句,不是一个问题。请检查此线程:@Mariostilov,语句本身有问题:)我想更改微调器提示的背景?提示是什么意思?如果它是下拉列表,那么它的android:popupBackground=“@drawable/spinner_shape”