android - Actionbar menu items not visible -
i want icons on action bar, getting them in menu options... here xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/share" android:orderincategory="100" android:title="share on whatsapp" app:showasaction="always" /> <item android:id="@+id/medication" android:title="my medications" android:icon="@drawable/medication" app:showasaction="always" /> <item android:id="@+id/coc" android:title="add circle of care" android:icon="@drawable/add_icon" app:showasaction="always" /> <item android:id="@+id/report" android:title="report" android:icon="@drawable/report" app:showasaction="always" /> </menu>
and here java
@override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.dashboard, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if (id == android.r.id.home) { menu.toggle(true); return true; } if(id == r.id.coc){ startactivity(new intent(dashboard.this,circleofcare.class)); } return super.onoptionsitemselected(item); }
what missing.. extending activity.. if extend actionbaractivity, says, use theme.appcompat or descendant when using theme only. please help, thanx in advance
if aren't using actionbaractivity try using
android:showasaction="always"
instead of
app:showasaction="always"
Comments
Post a Comment