toolbar加红点方案就是更换图片
核心代码
//设置ToolBar
final Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setTitleTextColor(Color.WHITE);
setSupportActionBar(mToolbar);
actionBar = getSupportActionBar();
//设置抽屉DrawerLayout
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar,
R.string.drawer_open, R.string.drawer_close);
mDrawerToggle.syncState();//初始化状态
actionBar.setDisplayHomeAsUpEnabled(true);//设置返回箭头显示
actionBar.setHomeAsUpIndicator(android.R.drawable.ic_lock_power_off);
mDrawerLayout.setDrawerListener(mDrawerToggle);
如有疑问请戳这里 東方月初