I have an toolbar with overflow menu icon with menu items. I need to change the overflow icon to the circular imageview.
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="@color/white"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_image"
android:layout_width="38dp"
android:layout_height="30dp"
android:layout_gravity="right|end"
app:srcCompat="@android:drawable/sym_def_app_icon"/>
</android.support.v7.widget.Toolbar>
And the code looks like.
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar);
CircleImageView mciv = (CircleImageView) findViewById(R.id.profile_image);
setSupportActionBar(toolbarTop);
I have tried to change the overflow icon but most of SO mentioned about of using drawable. But i need to use the imageview. I have tried with the below
@Override
public boolean onOptionsItemSelected(MenuItem item) {
item.setActionView(mciv);
return super.onOptionsItemSelected(item);
}
But its not working. How to change overflow menu icon with imageview?