Java 导航栏未在kitkat中显示

Java 导航栏未在kitkat中显示,java,android,user-interface,Java,Android,User Interface,这是我涉及导航栏的代码。在kitkat以上的android版本上,导航栏很容易显示,但在kitkat及以下版本中,导航栏不显示 toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new A

这是我涉及导航栏的代码。在kitkat以上的android版本上,导航栏很容易显示,但在kitkat及以下版本中,导航栏不显示

toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
        this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);

您使用的是哪个工具栏?
appcompat.toolbar
还是只使用
toolbar
?我使用的是just toolbar@sripadraj您应该在xml中使用
android.support.v7.widget.toolbar
,并在java中声明。注意:您必须导入才能使用appcompat工具栏。使用抽屉布局后,导航栏显示,但应用程序冻结@SripadRajfreezes,应用程序不响应??或者不幸停止??您使用的是哪个工具栏
appcompat.toolbar
还是只使用
toolbar
?我只使用toolbar@SripadRajYou应该在xml中使用android.support.v7.widget.toolbar,并在java中声明。注意:您必须导入才能使用appcompat工具栏。使用抽屉布局后,导航栏显示,但应用程序冻结@SripadRajfreezes,应用程序不响应??还是不幸停止了??