首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Xamarin.Android中将工具栏的黑色文本转换为白色,同时保留活动文本的黑色文本?

如何在Xamarin.Android中将工具栏的黑色文本转换为白色,同时保留活动文本的黑色文本?
EN

Stack Overflow用户
提问于 2015-06-19 14:13:49
回答 1查看 1.1K关注 0票数 1

我使用下面的代码在xamarin.android中创建了一个工具栏。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/android-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />

但是文本颜色显示为黑色,但我希望它是白色的。我的朋友让我这么做的。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/android-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" 

app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

但它显示了以下错误。

代码语言:javascript
复制
"No resource identifier found for attribute "theme" in package "android-auto"
"no resource identifier found for attribute "popupTheme" in package "android-auto"

你能推荐一些代码吗?

EN

回答 1

Stack Overflow用户

发布于 2015-06-20 22:24:03

我想您在这里使用的是错误的包app:而不是android:

代码语言:javascript
复制
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

试试这个:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com//apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/actionBarSize"
    android:background="?android:attr/colorPrimary"
    android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
    android:popupTheme="@android:style/ThemeOverlay.Material.Light" />
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30931110

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档