作爲一個noob,我發現這個問題的其他答案很難理解。我初始化一個微調,像這樣:如何更改微調器的文本顏色
mMembership = (Spinner) findViewById(R.id.RegisterMembershipSpinner);
ArrayAdapter<CharSequence> member_adapter = ArrayAdapter.createFromResource(this,
R.array.membership_array, android.R.layout.simple_spinner_item);
// Specify the layout to use when the list of choices appears
member_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
mMembership.setAdapter(member_adapter);
而且我已經創建和XML稱爲佈局文件夾包含以下內容spinner_items.xml:
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:gravity="left"
android:textColor="#FFFFFF"
android:padding="5dip"
android:id="@+id/textSpinner"
/>
我應該從這裏做的,以允許我改變微調項目的文本顏色?
後a屏幕截圖 – Shreyans
您的'spinner_items'文件具有您的'textColor'屬性,將'#FFFFFF'更改爲其他內容。那是黑色的,所以如果你的背景是黑色的,你將看不到它。另外,不要硬編碼你的顏色值使用'colors.xml'文件來定義你的顏色,並使用'@color/your_defined_color'調用它# – Pztar
#FFFFFF是白色的。仍然有同樣的錯誤 – Cian