相关疑难解决方法(0)

工具栏的徽标图标是否可点击?

我已经使用了工具栏所以现在我想在徽标图标上应用点击事件我怎么能得到这个事件?

这是我做过的一些编码

Toolbar toolbar = null;
toolbar = (Toolbar) findViewById(R.id.actionToolbar);
setSupportActionBar(toolbar);
setTitle(null);
toolbar.setNavigationIcon(R.drawable.back);
toolbar.setNavigationContentDescription("BACK");
toolbar.setLogo(R.drawable.ic_launcher);
toolbar.setLogoDescription("LOGO");

toolbar.setNavigationOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Toast.makeText(MainActivity.this, "Nav", Toast.LENGTH_SHORT).show();
    }
});
Run Code Online (Sandbox Code Playgroud)

在这里,我设置了导航图标和徽标图标,所以现在我想要logo图标的点击事件,怎么可能?

android toolbar android-actionbar android-5.0-lollipop

6
推荐指数
2
解决办法
7528
查看次数