android - options menu action bar -
can see why icon isn't showing in action bar? have pasted relevant parts of code below
thank you
menu topline.xml: `
<item android:id="@+id/gohome_id" android:title="home" trial10:showasaction="ifroom" /> <item android:id="@+id/helpme_id" android:title="help" android:icon="@drawable/ic_questionmark" android:orderincategory="200" trial10:showasaction="always" />
`
styles.xml:
<style name="apptheme" parent="theme.appcompat.light.darkactionbar"> </style> <style name="customactionbartheme" parent="@android:style/theme.holo.light.darkactionbar"> <item name="android:actionbarstyle">@style/myactionbar</item> </style> <style name="myactionbar" parent="@android:style/widget.holo.light.actionbar.solid.inverse"> <item name="android:background">@drawable/logo3</item> <item name="android:icon">@drawable/leaflogo</item> </style> <style name="orangestyle" parent="@android:style/theme.notitlebar"> <item name="android:windowbackground">@color/orange</item> </style>'
this in activity java:
@override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.topline, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { super.onoptionsitemselected(item); switch(item.getitemid()){ case r.id.gohome_id: gohome(); break; } return true; }
finally, manifest:
<activity android:name=".test1" android:label="test" android:theme="@style/customactionbartheme" > </activity>
try
<item android:id="@+id/gohome_id" android:title="home" android:showasaction="ifroom" /> <item android:id="@+id/helpme_id" android:title="help" android:icon="@drawable/ic_questionmark" android:showasaction="always" />
Comments
Post a Comment