這個問題本來是個不大的問題,但是遇到了就會很郁悶,Android控件的api本身就不太夠強大,這個小屬性找了好久沒找到,今天終於解決,分享給所有遇到這個問題的朋友。
spinner下拉列表中間有一條黑色的分割線,想要改變它的顏色值,就要重寫style。
備注:后來發現 AutoCompleteTextView 的下划線也需要同樣的解決辦法,所以我認為凡是使用到系統下來列表的控件,全部都需要使用注冊樣式來解決,就如這篇文章中我描述一樣。歡迎補充
1.首先 ,在themes里面寫一個style
<style name="applicationTheme" parent="@android:style/Theme.Light">
<item name="android:dropDownListViewStyle">@style/mySpinnerStyle</item>
</style>
<style name="mySpinnerStyle" parent="android:style/Widget.ListView.DropDown">
<item name="android:divider">#00ff00</item>
<item name="android:dividerHeight">1dp</item>
</style>
2.然后再它的父activity在manifest 下,寫一個自定義的themes樣式,引用這個就行了。
<activity android:name="org.videolan.vlcn.vrActivity" android:configChanges="orientation|screenSize|keyboardHidden" android:launchMode="singleTask" android:screenOrientation="portrait" android:theme="@style/applicationTheme" > <intent-filter > <action android:name="com.sina.weibo.sdk.action.ACTION_SDK_REQ_ACTIVITY" /> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity>
3.當前是藍色的線,效果如下: