0

我正在将此绑定用于 MikePenz 的这个很棒的 Material Drawer Library。

我已经用这个库实现了导航抽屉,当我深入时,我还设法将汉堡菜单更改为后退箭头。现在我有一些问题要让后退箭头正常工作。当我单击后退箭头而不是返回上一页时,它会打开导航抽屉。

查看原始库后,我确定,以下代码负责管理后退箭头按钮。如果有人可以帮助我用 C# 编写此侦听器代码,我将不胜感激。

.withOnDrawerNavigationListener(new Drawer.OnDrawerNavigationListener() {
                @Override
                public boolean onNavigationClickListener(View clickedView) {
                    //this method is only called if the Arrow icon is shown. The hamburger is automatically managed by the MaterialDrawer
                    //if the back arrow is shown. close the activity
                    AdvancedActivity.this.finish();
                    //return true if we have consumed the event
                    return true;
                }
            })

这是我使用的绑定库:MaterialDrawer-Xamarin

这是原始库的链接:MaterialDrawer

4

1 回答 1

1

尝试这样的事情:

var result = new DrawerBuilder()
        .WithActivity(this)
        .AddDrawerItems(
          //Add some items here
          new DividerDrawerItem()
        )
        .WithOnDrawerNavigationListener(this);

Drawer.IOnDrawerNavigationListener像这样在您的活动中实施:

public bool OnNavigationClickListener(View clickedView)
{
    this.Finish();
    return true;
}
于 2016-04-21T21:44:08.497 回答