android - SherlockActionBar not showing on 4.2.2 -
my sherlock action bar work on samsung galaxy s2 4.0.3 , emulator 2.1 not on nexus 10 4.2.2, can't figure out why.
here related code :
in main activity :
actionbar ab = getsupportactionbar(); ab.setdisplayshowtitleenabled(false); ab.setdisplayshowhomeenabled(false);
...
@override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { // stuff calendarcontract case r.id.action_settings: intent viewintent = new intent(this, settingsactivity.class); startactivityforresult(viewintent, 2); break; case r.id.add_alarm: loadtimer(); break; default: break; } return super.onoptionsitemselected(item); }
...
@override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getsupportmenuinflater(); inflater.inflate(r.menu.mainmenu, menu); return true; }
manifest :
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk android:minsdkversion="4" android:targetsdkversion="14" /> <application android:allowbackup="true" android:icon="@drawable/icon_launcher" android:label="@string/app_name" android:theme="@style/mytheme" > <activity android:name=".mainactivity" android:label="@string/app_name" android:screenorientation="portrait" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".alarmreceiveractivity" android:label="@string/app_name" android:screenorientation="portrait" android:theme="@android:style/theme.notitlebar" > </activity> <activity android:name=".settingsactivity" android:screenorientation="portrait" > </activity> <activity android:name=".pickadayactivity" android:excludefromrecents="true" android:screenorientation="portrait" android:theme="@android:style/theme.dialog" > </activity> <receiver android:name="com.paradroid.paradroidalarm.mybroadcastreceiver" > <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver> <activity android:name="com.appflood.afpanelactivity" android:configchanges="keyboardhidden" > </activity> <activity android:name="com.appflood.affullscreenactivity" android:configchanges="keyboardhidden|orientation" android:launchmode="singletask" android:theme="@android:style/theme.translucent" > </activity> <activity android:name="com.appflood.notification.notificationactivity" > <intent-filter> <action android:name="" /> </intent-filter> </activity> <activity android:name="com.appflood.aflistactivity" android:configchanges="keyboardhidden|orientation" android:launchmode="singletask" android:theme="@android:style/theme.translucent" > <intent-filter> <action android:name="" /> </intent-filter> </activity> <activity android:name="com.appflood.afinterstitialactivity" android:configchanges="keyboardhidden|orientation" android:launchmode="singletask" android:screenorientation="portrait" android:theme="@android:style/theme.translucent" > </activity> <!-- gcm service , receiver --> </application> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.receive_boot_completed" /> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.record_audio" />
style.xml :
<?xml version="1.0" encoding="utf-8"?>
--> <style name="appbasetheme" parent="android:theme.light"></style> <!-- theme customizations available in newer api levels can go in res/values-vxx/styles.xml, while customizations related backward-compatibility can go here. --> <!-- application theme. --> <style name="apptheme" parent="appbasetheme"> <!-- customizations not specific particular api-level can go here. --> </style> <style name="dialog_theme"> <item name="android:windowbackground">@android:color/transparent</item> <item name="android:windownotitle">true</item> </style> <style name="mytheme" parent="@style/theme.sherlock.light"> <item name="android:actionbarstyle">@style/myactionbar</item> <item name="android:actionmenutextcolor">#ffffff</item> </style> <style name="myactionbar" parent="@style/theme.sherlock.light.darkactionbar"> <item name="android:background">#89c2f6</item> </style>
mainmenu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/add_alarm" android:icon="@drawable/add_alarm" android:orderincategory="100" android:showasaction="ifroom" android:title="@string/add_alarm_title"/> <item android:id="@+id/action_settings" android:showasaction="ifroom" android:title="@string/menu" > </item>
thanks.
i see activities use different themes. activities want actionbar must extended theme.sherlock.
Comments
Post a Comment