更新:显然这是故意的,参见here .
编辑:事实证明,问题是工具栏没有添加到 MasterDetailPage,而是添加到我设置为详细信息页面的页面(在我的例子中是 NavigationPage ).
那么问题就变成了:为什么我用MasterDetailPage的时候没有Toolbar?
我已经升级到新的 FormsAppCompatActivity。有很多错误,我会一一解决。
现在,抽屉显示在工具栏上。我希望工具栏始终位于顶部,因此抽屉应位于其下方。
我的 RootView 是一个 MasterDetailPage:
RootView = new MasterDetailPage {
Master = PageSubs,
Detail = AppNavPage,
};
这是我的 style.xml:
<style name="LightTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="toolbar_style">@style/LightToolbar</item>
ToolbarStyle.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="LightToolbar" parent="Widget.AppCompat.Toolbar">
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="android:popupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="android:background">#0087DC</item>
</style>
<style name="DarkToolbar" parent="Widget.AppCompat.Toolbar">
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="android:popupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="android:background">#ff0000</item>
</style>
<style name="AMOLEDToolbar" parent="DarkToolbar">
<item name="android:background">#000000</item>
</style>
</resources>
最佳答案
事实证明,这是 Google 现在强制执行的默认行为。
https://www.google.com/design/spec/patterns/navigation-drawer.html
关于android - FormsAppCompatActivity 和 MasterDetailPage : no Toolbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33323196/