无论抽奖菜单是否可见,我都需要向用户显示汉堡包图标。我想我应该提一下,抽屉页面不是我的根页。
这是我活动的代码:
public class MainActivity : MvxCachingFragmentCompatActivity<MainViewModel>
{
protected override void OnCreate(Bundle bundle)
{
SetSupportActionBar(FindViewById<Toolbar>(Resource.Id.toolbar));
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.Title = "All Requests";
_drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawerLayout);
_drawerToggle = new ActionBarDrawerToggle(
this,
_drawerLayout,
Resource.String.OpenDrawerString,
Resource.String.CloseDrawerString);
_drawerLayout.AddDrawerListener(_drawerToggle);
_drawerToggle.SyncState();
}
这是工具栏视图,我包括:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:background="@color/blue"
android:elevation="4dp"
style="@style/Base_ToolbarStyle"
/>