ActionBar Sherlock SwitchWidget - android

Is there a Switch widget that comes with Android 4.0 and above in the ActionBarSherlock packages. I see ABS has a 4.0 compatible Spinner View, but no Switch. Does Jake intend to include this in any near release?

No, the Switch component is not part of the action bar and hence will never be part of ActionBarSherlock. The Spinner that is included is a subset of the full version which only has the necessary features required to work inside the action bar.
If you need a components like this on all versions of Android I suggest you backport it yourself. Just grab the source, styles, and drawables and fix up any usage of new APIs to use old or compatible method calls.

Related

Is there any benifit of ActionBarSherlock if my app run using android 4 and above

I was using ActionBarSherlock to make my app run with app version of android and use actionbar, but now I don't need to support the old version and it is enough for me to support 4 and above , is there any benefit of ActionBarSherlock still for my case ?
Not really. Feel free to use the native API Level 11+ implementation of the action bar.
Note, though, that some things in Android may steer you in the direction of using an action bar backport... though the appcompat one published by Google, not ActionBarSherlock. For example, the recommended version of MediaRouteActionButton requires the appcompat action bar, though I am maintaining a port that works with the regular action bar.

Implementing an Action Bar: ABSherlock or ABCompat?

The application currently has tabulations and bar custom made (by previous guy) from fragments to copy cat Apple design.
I want to move toward Android action bar to provide Android experience and usual behavior.
Should I implement Action Bar Sherlock or Action Bar Compat?
Pro ABS:
Lots of documentation
Action bar Tabs is well known (that's what I need to do)
About Holo theme? ABS is great to support it, how perform ABCompat?
Pro ABCompat:
Supported by Google (better in the long run?)
Better connection with navigation drawer (but I will not use one)
No external dependencies in Java Build path
What others arguments help decide? Which one should I pick ?
From my point of view, provided I succeed to do a action bar with fixed tabs, the Action Bar compatibility is the best choice (but not by much).
Thank you for helping me! (even providing arguments I missed)
The main reason that made me switch to ActionBarCompat is the Menu appearence in devices with android <= 2.3. With ActionBarSherlock, the menu appears very ugly, with the default menu of the device. With the ActionBarCompat, the menu appears the same way it appears when you open it in devices with Android >= 4.0 and hardware menu key.
But, be aware that the ActionBarCompat has some bugs to be resolved yet. I'm dealing with this bug:
SearchView taking all the space in the new ActionBarCompat
UPDATE:
Another bug:
https://code.google.com/p/android/issues/detail?id=58321&thanks=58321&ts=1375277660
UPDATE:
I've created a patched version of the ActionBarCompat to solve the issue with the ActionMode. See here:
The ActionMode is being created twice with the ActionBarCompat r18
The reasons why I migrated my app from ABS to Action Bar Compat were as follows:
I have only a very basic implementation of action bar tabs and I could see it would be simple to migrate
I prefer the Google documentation - it is clearer and more complete
Software maintenance will be simpler and less error prone because I now have no external dependencies.
I had run into a problem with ABS whereby I wanted to handle an orientation change (but you can't because of the way ABS hooks in to Android).
I haven't seen any statements from anybody connected with ABS about their long term plans for ABS. So I'm not convinced they are going to continue to support it. I may be wrong - but I haven't seen anything.
Performance is not really an issue for me, but I can't see why Google's "native" implementation would run slower than ABS and I suspect that it may perform better.
These are just my personal impressions.
I think that ActionBarSherlock was a brilliant piece of work, and a great service to Android developers. (By the way I don't have shares in Jake Wharton its developer.) Google have paid it the best compliment possible by including something that does essentially the same thing in essentially the same way (as far as I can tell) in the v7 support library.
But now that the functionality is officially supported some standard arguments apply as to which to choose.
ActionBarSherlock is a third party dependency, which represents a risk in terms of ongoing support. Unless it does something you really need that is not done by ActionBarCompat, or the latter has a bug which you can't work around or wait for a fix for, there's very little argument in favour of sticking with the former.
I recently migrated from ActionBarSherlock to ActionBarCompat and found only one or two minor issues, the main one being that a minor adjustment was required to the stock 9-patch images used for the action bar tab indicator backgrounds, in order to produce the standard tab behaviour on earlier android versions, in my case 2.2==API level 8==Froyo. (Specifically I adjusted the vertical stretchable regions so that they were not adjacent either to the top edge or the colored indicator bar at the bottom of the image.)

Sherlock Actionbar RTL

Android 4.2 introduced the support for Right To Left action bar, is there a way to configure the Sherlock Action bar to be in RTL mode?
note that the current Sherlock Actionbar version is 4.2, but I couldn't find anything related to the RTL support.
As of this time, the RTL feature of the ActionBar has not been included in the support library. From what I can gather, it's not scheduled to be, either, since there were some changes to the underlying View structure.
If you're using ActionBarSherlock, it will work the same as if you're using a native ActionBar. From 4.2 up, it will support RTL, and not on lower platform levels. Assuming you have android:supportsRtl="true" in your manifest, that is.
If you want to have a good RTL experience for all users, while still using the native RTL support for those on >=4.2, you can check the build level in your app and plan accordingly.
The alternatives as I see it are:
Use a custom layout for all users and forgo the ease of the new API levels
Support RTL for no users
Your question was: "Is there any way to configure ABS for RTL?". The answer to that is yes, but only if users are on 4.2. For anything lower than that, there is simply no way to do it without custom layouts.

Android TabHost deprecated

I am creating application which will support Android 2.2 to Android 4.1. The TabHost is deprecated in Android version 3.2. But the created application supported in all the versions. But I want to create the Tab bar application which will look like a tab bar in Android 4.1 while running the application in Android 4.2, If I am running the application in below android 3.2 version device, it must look like the tab bar in that device. How can I do this.?
There are many points to your question,
TabHost is not deprecated yet. Recently Google deprecated TabActivity and ActivityGroup.
Even if it deprecated, it doesn't mean it can't be used. If X is deprecated, it only means a better alternative named Y is there.
Now to answer your question, You have more than one options
You can use ActionBarSherlock as other answers suggests. (EDIT : ActionBarSherlock is now deprecated.)
You can use TabHost with fragments, See my answer here for a
good example. To use Fragment in pre 3.0 API's you need to use
Google's support library.
Try out ActionBarSherlock.
ActionBarSherlock is an extension of the support library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
Tutorials:
tutorial 1 , tutorial 2 ,
tutorial 3
Just to add, Android has introduced ActionBarCompat to ensure ActionBar is compatible with OS below 3.0 down to 2.1. You can use ActionBarCompat in the support library instead of ActionBarSherlock
http://android-developers.blogspot.co.uk/2013/08/actionbarcompat-and-io-2013-app-source.html

Steps to write better ActionBars in Android

These are my doubts while using ActionBar.
1) To make it prevalent across various tabs, I had to repeat the same code in all the tabs. Is there a better way to rewrite this part? I could have one ActionBar class which I can call everywhere, but that won't make it dynamic. (More options in certain tabs.)
2) I'm presently defining a menu and inflating it. Is it the best way to go about it? The problem I am facing here is I'm definitely not using the entire space and always running out of space to put in more actions. How to rectify it?
3) The third problem that I'm facing is a bug when I use Theme.Light. The app crashes. If I use Theme.Holo.Light, the app doesn't. Though, it still crashes in a 2.3 supporting phone. Anyway to rectify that? I mostly feel that I've missed out on backward compatibility or is Action bar not compatible with certain themes?
This answers your 3rd question, straight from docs here:
Beginning with Android 3.0 (API level 11), the action bar is included in all activities that use the Theme.Holo theme (or one of its descendants), which is the default theme when either the targetSdkVersion or minSdkVersion attribute is set to "11" or greater.
If you want to use ActionBar APIs, such as to add navigation modes and modify action bar styles, you should set the minSdkVersion to "11" or greater. If you want your app to support older versions of Android, there are ways to use a limited set of ActionBar APIs on devices that support API level 11 or higher, while still running on older versions. See the sidebox for information about remaining backward-compatible.
Sidebox info
If you want to provide an action bar in your application and remain compatible with versions of Android older than 3.0, you need to create the action bar in your activity's layout (because the ActionBar class is not available on older versions).
To help you, the Action Bar Compatibility sample app provides an API layer and action bar layout that allows your app to use some of the ActionBar APIs and also support older versions of Android by replacing the traditional title bar with a custom action bar layout.

Categories

Resources