ActionBarSherlock: Button not appearing on Android 2 -
i'm using actionbarsherlock because want create unified many devices. want support devices down android 2 version. testing have a
-lg nexus 4 --running android 4.2.2 -samsung galaxy ace --running android 2.3.3
to begin using abs fetched sample code samples shipped abs. used actionitems.java example-file. used 1 delete-button. copied appropriate drawables res folders (see screenshot). (i created ldpi-version 36x36pixels- saved alpha channel)
the problem delete icon won't appear on samsung ace android 2.3.3. see screenshot wrong code? here's code:
@suppresslint("newapi") public class mainactivity extends sherlockactivity implements observer { public static int theme = r.style.theme_sherlock_light; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); filltableviewwithevents(); settheme(r.style.theme_sherlock); settitle(...); } public boolean oncreateoptionsmenu(menu menu) { //used put dark icons on light action bar boolean islight = theme == r.style.theme_sherlock_light; menuitem.show_as_action_with_text); menu.add("delete") .seticon(islight ? r.drawable.ic_action_delete : r.drawable.ic_action_delete) .setshowasaction(menuitem.show_as_action_if_room | menuitem.show_as_action_with_text); return true; }
in androidmanifest.xml added line (replacing old @style statement
android:theme="@style/theme.sherlock"
Comments
Post a Comment