0

I'm trying to use CircleImageView as ActionBar icon (like chatting activity in WhatsApp). I've tried this approach:

CircleImageView actionBarIcon_Profile = new CircleImageView(this);
actionBarIcon_Profile.setImageDrawable(getResources().getDrawable(R.drawable.my_picture));
actionBarIcon_Profile.setLayoutParams(new LayoutParams(48, 48));
actionBarIcon_Profile.setId(R.id.actionBarIcon_Profile);

getActionBar().setIcon(R.id.actionBarIcon_Profile);

ids.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item type="id" name="actionBarIcon_Profile"/>
</resources>

It seems like ActionBar setIcon() only accepts drawables as input. I could have setup a circular shape xml and put it in my drawable folder, but even that I have to change the background of that xml file to fit my need. Any suggestions?

Community
  • 1
  • 1
Hendra Anggrian
  • 5,780
  • 13
  • 57
  • 97

1 Answers1

0

link - http://javatechig.com/android/actionbar-with-custom-view-example-in-android

see if this link helps you

Ishant Sagar
  • 228
  • 5
  • 13
  • I understand that I can do that as well, but that would change the entire action bar. I just want to change the icon. If it isn't possible to do, I would definitely try your solution. – Hendra Anggrian Mar 14 '15 at 12:41