In my application , i created a navigation drawer using Android studio template. It works perfectly in Android 5.0 above devices but the title bar does not appear in Kitkat devices (only statius bar can be seen) , I was unable to find a solution,
The below is my code
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().show();
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) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
Intent intent = getIntent();
linkNo = intent.getIntExtra(FirstMenuFragment.LINK_NO, 0);
//Make firstItem active
navigationView.getMenu().getItem(linkNo).setChecked(true);
}
Thanks in advance
In KitKat, making the statusbar (semi-)transparent is more complex compared to Lollipop+. So the titlebar is still there, it's just below the status bar ;)
Edit: If you absolutely want to achieve this on KitKat, you could use a SystemBarTintManager ( https://github.com/jgilfelt/SystemBarTint/blob/master/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java ).
But I don't recommend that, I've done it myself and it's not so easy to get it right.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.