我忙着设计我的应用程序的主题(蓝色/黑色和橙色边缘)。我成功地管理了操作栏,但是我在操作栏中遇到了微调/下拉菜单问题。任何人都可以建议我做什么来使旋转器橙色内的文本颜色。不是实际的微调器项目,只是显示在顶部的项目,即所选项目。
我为旋转器使用的样式如下所示:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- API 11 theme customizations can go here. -->
</style>
<!-- SQUASHBOT THEME -->
<style name="SquashBotTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/SquashBotTheme.ActionBarTheme</item>
<item name="android:actionDropDownStyle">@style/SquashBotTheme.DropDownNavigation</item>
</style>
<!-- ACTIONBAR THEME -->
<style name="SquashBotTheme.ActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/actionbar_theme</item>
<item name="android:titleTextStyle">@style/SquashBotTheme.TitleText</item>
</style>
<!-- TITLE TEXT -->
<style name="SquashBotTheme.TitleText" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:textColor">@color/OrangeRed</item>
</style>
<!-- DROPDOWN ITEM -->
<style name="SquashBotTheme.DropDownNavigation" parent="@android:style/Widget.Holo.Spinner">
<item name = "android:textAppearance">@color/OrangeRed</item>
<item name = "android:textColor">@color/OrangeRed</item>
<item name = "android:popupBackground">@color/OrangeRed</item>
</style>
</resources>
如您所见,我已经尝试使用textAppearance
和textColor
。任何建议都会非常感激。
答案 0 :(得分:2)
你可以尝试这个:
spinner_item.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/YourStyleIsHere"
android:background="@color/white"
android:layout_width="match_parent"
android:singleLine="true"
android:drawableRight="@drawable/ic_action_dropdawn2"
android:ellipsize="end" />
dropdown_item.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/YourAnotherStyle"
android:layout_width="match_parent"
android:background="@drawable/phone_ripple"
android:padding="20dp"
android:ellipsize="end" />
适配器
adapter = new YourAdapter(context, R.layout.spinner_item, models);
adapter.setDropDownViewResource(R.layout.dropdown_item);
样式有父@deroid:style / TextAppearance&#34;