使用AppCompat-v7在actionbar /工具栏中显示图标21(show icon in actionbar/toolbar with AppCompat-v7 21)
我试过这些 - 但仍然看不到像以前的图标:
getSupportActionBar().setLogo(R.drawable.ic_launcher); getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setIcon(R.drawable.ic_launcher);当我使用自定义工具栏时,它似乎工作 - 但这将迫使我触摸所有布局 - 有更好的方法吗?
I tried these - but still do not see the icon like before:
getSupportActionBar().setLogo(R.drawable.ic_launcher); getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setIcon(R.drawable.ic_launcher);It seems to work when I use custom toolbar - but that would force me to touch all layouts - is there a better way to do so?
最满意答案
getSupportActionBar().setDisplayShowHomeEnabled(true);
随着
getSupportActionBar().setIcon(R.drawable.ic_launcher);
getSupportActionBar().setDisplayShowHomeEnabled(true);along with
getSupportActionBar().setIcon(R.drawable.ic_launcher);更多推荐
发布评论