5

I am trying put image exactly with the back button of toolbar. But i don't know how to achieve it. The closest i got was this :

enter image description here but this is not nearly what i want. I want it exactly with the back button meaning that the back button and the image combined should be equal to the back button. So how do i achieve this??

enter image description here

my code was pretty simple :

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSupportActionBar(toolbar);
toolbar.setLogo(ContextCompat.getDrawable(mContext, R.drawable.group_image));

So can someone please help me.

Syed Muhammad Oan
  • 687
  • 2
  • 15
  • 39

2 Answers2

0

Try something like this

 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 getSupportActionBar().setDisplayShowHomeEnabled(true);
 getSupportActionBar().setIcon(R.drawable.your_icon);
Masum
  • 4,879
  • 2
  • 23
  • 28
  • 1
    follow this [link](http://stackoverflow.com/questions/31788678/android-toolbar-back-arrow-with-icon-like-whatsapp) – Masum Jun 03 '16 at 17:12
0

You can create custom view for your action bar and set that view.

actionBar.setCustomView(R.layout.conversation_actionbar);
Saeed Sharman
  • 765
  • 5
  • 24