Difference between ActionBarSherlock and ActionBar Compatibility

ActionBarSherlock vs ActionBarCompat: I Just want to put few code difference between ActionBarSherlock vs ActionBarCompat Lib We can migrate some apps from ActionBarSherlock to ActionBarCompat: steps: Import AppCompat project. Replace SherlockFragmentActivity with ActionBarActivity. Replace SherlockFragment with Fragment. Change Menu, MenuItem and getSupportMenuInflater() references. Modify the way you get Action Views. mSearchView = (SearchView)MenuItemCompat.getActionView(mSearchItem) Modify your … Read more

How to force use of overflow menu on devices with menu button

You can also use this little hack here: try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField(“sHasPermanentMenuKey”); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ignored) { } Good place to put it would be the onCreate-Method of your Application class. It will force the App to show the overflow … Read more

Switching between Android Navigation Drawer image and Up caret when using fragments

It’s easy as 1-2-3. If you want to achieve: 1) Drawer Indicator – when no fragments are in the Back Stack or the Drawer is opened 2) Arrow – when some Fragments are in the Back Stack private FragmentManager.OnBackStackChangedListener mOnBackStackChangedListener = new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { syncActionBarArrowState(); } }; @Override protected void … Read more

Action bar navigation modes are deprecated in Android L

The new Android Design Support Library adds TabLayout, providing a tab implementation that matches the material design guidelines for tabs. A complete walkthrough of how to implement Tabs and ViewPager can be found in this video Now deprecated: The PagerTabStrip is part of the support library (and has been for some time) and serves as … Read more

What is the difference between Action Bar and newly introduced Toolbar?

I found a good explanation from Android Developers Blog post. In this release, Android introduces a new Toolbar widget. This is a generalization of the Action Bar pattern that gives you much more control and flexibility. Toolbar is a view in your hierarchy just like any other, making it easier to interleave with the rest … Read more

Remove shadow below actionbar

What is the style item to make it disappear? In order to remove the shadow add this to your app theme: <style name=”MyAppTheme” parent=”android:Theme.Holo.Light”> <item name=”android:windowContentOverlay”>@null</item> </style> UPDATE: As @Quinny898 stated, on Android 5.0 this has changed, you have to call setElevation(0) on your action bar. Note that if you’re using the support library you … Read more