【发布时间】:2015-03-22 17:35:01
【问题描述】:
我不知道如何在具有 v21 Material 主题的深色背景抽屉中设置此微调器的样式。我尝试了各种涉及自定义样式的方法,但似乎与这个微调器的外观没有什么不同。
这是在 Android 5.0.1 上运行的应用中的外观。微调器,此处带有选定项目“2015 年海滩上的代码”,位于深色背景 (#DD000000) 的抽屉中,但应用程序的其余部分是浅色主题。箭头显示为黑色 - 在设备上几乎看不到。我想让它有一个白色箭头。
这是我的 styles.xml 文件:
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="app_theme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#E95624</item>
<item name="colorPrimaryDark">#BD4000</item>
<item name="colorAccent">#86d3c5</item>
<item name="windowActionBar">false</item>
</style>
</resources>
这里是 Main.axml 文件,这个活动的主要布局,包含 DrawerLayout 和 Spinner:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
a:layout_width="match_parent"
a:layout_height="match_parent"
a:orientation="vertical">
<android.support.v7.widget.Toolbar
a:id="@+id/main_toolbar"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:minHeight="?attr/actionBarSize"
a:background="?attr/colorPrimary"
a:elevation="2dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.DrawerLayout
a:id="@+id/drawer_layout"
a:layout_width="match_parent"
a:layout_height="match_parent">
<FrameLayout
a:id="@+id/content_frame"
a:layout_width="match_parent"
a:layout_height="match_parent" />
<LinearLayout
a:id="@+id/left_drawer"
a:orientation="vertical"
a:layout_width="240dp"
a:layout_height="match_parent"
a:layout_gravity="start"
a:background="#DD000000">
<Spinner
a:id="@+id/event_spinner"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:padding="4dp" />
<ListView
a:id="@+id/left_drawer_list"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:choiceMode="singleChoice"
a:divider="@android:color/transparent"
a:dividerHeight="0dp" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
如果相关,这里是设置微调器适配器的代码(Xamarin C#):
var adapter = new ArrayAdapter<string>(SupportActionBar.ThemedContext, Resource.Layout.event_selector, events);
adapter.SetDropDownViewResource(global::Android.Resource.Layout.SimpleSpinnerDropDownItem);
_eventSelector.Adapter = adapter;
这是我的event_selector.axml(截图后我将textColor改为#fff,不影响箭头颜色):
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="8dp"
android:textSize="16sp"
android:textColor="#fff" />
我需要对我的 .axml 或 styles.xml 文件进行哪些修改才能给这个微调器一个白色箭头?提前致谢!
【问题讨论】:
标签: android xamarin xamarin.android material-design