How can I add app logo as well as app name?
I tried, but either logo appears or app name, not both.
Asked
Active
Viewed 508 times
1

Phantômaxx
- 37,901
- 21
- 84
- 115

Prinx Ghimirey
- 11
- 1
2 Answers
2
Have you tried setTitle()
and setNavigationIcon()
?
Toolbar toolbar=(Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("Title");
toolbar.setNavigationIcon(R.drawable.some_icon);

OneCricketeer
- 179,855
- 19
- 132
- 245
-
i'm a beginner and i'ts been a nightmare thank you so much – Prinx Ghimirey Aug 19 '16 at 17:46
-
Thanks i didn't used like that, but if i use `setNavigationIcon` it overlays `ActionBarDrawerToggle` icon when using `NavigationDrawer` like that : http://prntscr.com/c7twqu – Yasin Kaçmaz Aug 19 '16 at 17:50
-
@YasinKaçmaz I'm not sure what you are trying to show. The question said nothing about a `NavigationDrawer` – OneCricketeer Aug 19 '16 at 17:59
-
@cricket_007 I don't want to show something, I just want to give information about future viewers. Sorry for bothering, have a good day. – Yasin Kaçmaz Aug 19 '16 at 18:01
1
Just simple way :
Toolbar toolbar=(Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if(getSupportActionBar()!=null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(drawerArrowDrawable);
getSupportActionBar().setIcon(R.drawable.ic_label_black_48dp);
}
You will see a screen like that :

Yasin Kaçmaz
- 6,573
- 5
- 40
- 58
-
You don't need `getSupportActionBar`, do you? You already have `toolbar` – OneCricketeer Aug 19 '16 at 17:32
-
@cricket_007 `getSupportActionBar` returns an `ActionBar` and it has these methods. `Toolbar` don't have these methods. Maybe we can cast `Toolbar` to `ActionBar` but never tried like that, let me try. @Edit : I tried to cast `Toolbar` to `ActionBar` but not allowed. – Yasin Kaçmaz Aug 19 '16 at 17:34