0

如何在Android上將Picker Row標題從黑色更改爲白色?我嘗試了TSS,並在XML中使用屬性沒有成功。將Picker Row標題從黑色更改爲白色

XML

<Alloy> 
    <View top="80" height="70"> 
     <Label class="calendarViewDayDay" top="5" left="10" color="#FFFFFF" text="L('Rooms')"></Label> 
     <Picker id="Numberpicker2" top="20" left="10"> 
      <PickerColumn> 
       <PickerRow title="1" /> 
       <PickerRow title="2" /> 
       <PickerRow title="3" /> 
       <PickerRow title="4" /> 
       <PickerRow title="5" /> 
       <PickerRow title="6" /> 
       <PickerRow title="7" /> 
       <PickerRow title="8" /> 
       <PickerRow title="9" /> 
       <PickerRow title="10" /> 
      </PickerColumn> 
     </Picker> 
    </View> 
</Alloy> 
+1

[鈦Appcelerator的改變Android的選擇器的字體顏色]的可能的複製(http://stackoverflow.com/questions/ 29832782/changing-android-picker-font-color-on-titanium-appcelerator) –

+0

我可以推薦更改正確答案嗎? :) –

回答

4

改變顏色的唯一方法就是使用定製的Android主題。您必須添加自己的風格提到here,然後把上面的代碼,你的風格文件中:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="Theme.CustomTheme" parent="Theme.AppCompat"> 
     <item name="android:spinnerItemStyle">@style/MySpinnerItem</item> 
    </style> 
    <style name="MySpinnerItem" parent="@android:style/Widget.TextView.SpinnerItem"> 
     <item name="android:textColor">your_color_in_hex</item> 
    </style> 
</resources> 
+0

偉大的除了這個問題。事實上,這是正確的答案 –

相關問題