【发布时间】:2015-07-27 15:51:27
【问题描述】:
我正在使用 v7 appcompat 21 库来试用 Material Theme 操作栏。我对 styles.xml 使用以下代码
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyTheme" parent="Theme.AppCompat">
<item name="windowActionBar">false</item>
<item name="colorPrimary">#3c9cd7</item>
<item name="colorPrimaryDark">#127fba</item>
<item name="colorAccent">#006db0</item>
</style>
</resources>
我使用的布局是这样的
<android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-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" />
在我的应用程序中有许多带有不同背景可绘制对象的屏幕,我希望工具栏与这些颜色相匹配。我不想使用颜色标志。 这可以仅使用 xml 文件来完成吗? 我尝试更改 android:background,它可以工作,但通知栏颜色不会随之改变。
这一切都在 Xamarin Studios 中完成。
【问题讨论】:
标签: android android-actionbar material-design android-appcompat android-actionbar-compat