I found this library and liked it. Know i am searching info how to use it. I am creating app which support from SDK 2.1 to 4.*.
So i downloaded ActionBarSherlock version 4.0. Imported library and made dependence to that library. I was needed to use Api level 15, because it is requirement for library usage.
So i imported project Demo from samples.
Everything look fine, but i really don't like this:
[2012-03-29 11:18:46 - SampleList] Displaying it with 'Locale Language ___Region __, sw320dp, w320dp, h533dp, Normal Screen, Long screen aspect ratio, Portrait Orientation, Normal, Day time, High Density, Finger-based touchscreen, Soft keyboard, No keyboard, Exposed navigation, Trackball navigation, Screen resolution 800x480' which is compatible, but will actually be displayed with another more specific version of the layout.
However i need this library creating navigation bar on top of all my layouts and change buttons action up to which layout i am.
So my target is to do this NavigationBar:
Maybe someone have done this with ActionBarsherlock and could help me ?
Also is it possible with ActionbarSherlock to do on Top Navigation Bar and on buttom Tab Bar with images ?
it should look similar:
Thanks
The library was designed to mimic the Ice Cream Sandwich action bar which has fundamental differences in both design and interaction patterns. I'm fairly certain that you could bastardize ActionBarSherlock into looking somewhat like UIToolbar, but it would be far easier to just create custom views to do this for you.
Also, please do not do this. Not a single Android user on the planet will thank you an iOS interface on an Android device.
http://developer.android.com/design/index.html
Related
I can't tell if they're the same thing or not and they seem to have different methods for removing them but I'm not sure if those are just multiple methods to do the same thing or not.
So is there a difference and if there is what is it?
Ref:
https://developer.android.com/reference/android/R.id.html#title
https://developer.android.com/reference/android/app/ActionBar.html (with material design, it is usually represented by a Toolbar)
The Title bar is a small part of the UI that you can supply with some text and a color. You see it on a lot of Android 2.0 Apps. See here
The Actionbar is the bar with buttons that has back navigation etc. If you can chose, you use it instead of the Titlebar. See here
Different thing.
TitleBar - small (usually grey) strip at top of screen that lists your Application Name (mostly not used anywhere)
ActionBar - the core navigation component of modern Android apps - this is where you will put the main navigation components (including actions on the things in your activity, a title explaining where you are in the app, Share links, etc); To support this in all modern Android versions, you will need to use a library to implement this. ActionBarSherlock is a very popular one, and there is now ActionBarCompat, which was released in the latest Support Library.
Bottom line, TitleBar should be disabled in favor of ActionBar for applications targeting modern design standards
I'm creating Action Bar navigation tabs, but when the Action Bar is stacked the tabs are not getting the whole width space. I have a foto to illustrate it.
Is possible, in this case, giving to each tab 50% of the screen width?
Thank you
I'm editing to say that it's not a Sherlock Action Bar. And I'm working in a Samsung Galaxy Note 10.1 and in a Nexus 7. And now, testing it in the Nexus, I noticed that it's behaviour is different. Another screenshot:
I don't think that's feasible at the moment. I've been trying to do the same thing for the past few days, and here's what I have found so far.
The Android framework uses a class called ActionBarPolicy to set some rules regarding the ActionBar's behavior.
In this file (which can be found here : https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/view/ActionBarPolicy.java), you'll find a method called getStackedTabMaxWidth() which returns a dimen value (currently set in the ressources at 160dip).
This value is used is the inner class TabView placed in ScrollingTabContainerView (https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/widget/ScrollingTabContainerView.java). TabView is the private implementation of the ActionBar's TabBar.
Now I don't think this value nor this behavior can be modified, except maybe using Reflection. I don't know enough about it to do so, so if someone could manage such a thing, don't hesitate to say so, because this really is a bad behavior which doesn't look great on some tablets.
Android stacked action bar tabs do not have adjustable widths.
"Stacked action bar tabs now have a width limit. This prevents super-wide tabs that can span the whole screen. The cluster of tabs is centered if it does not span the full width. " https://android.googlesource.com/platform/frameworks/base/+/b8139af3dcae80c0030afd0354dc424a7c72c3d9
The solution is to use the TabLayout API from the Android Design Support Library released with Android 5.0. The Android Support library requires the appcompat library, but that dependency is resolved for you if you build using gradle.
For most developers, this will not be an issue, but the TabLayout setup requries at least SDK API level 22, because the appcompat dependency is compiled against 22. However, TabLayout does not have a runtime dependency on 22, meaning you can run it on devices up to API level 7.
tl;r - Use Tablayout from Android Design Library. Requires API level 22 on developer, but can run on older phones up to v7.
I want to create a custom title bar, somewhat like this, in my Android app. Please pardon if my question seems idiotic, I'm a beginner. Can anyone tell me if it is a titlebar or an Action bar? Plus how can I give this Shaded Black color to my titlebar/action bar?
PS: I'm using GingerBread on my Android. My app will require minimum SDK version to be 4 but it targets Jelly bean too. In GingerBread, I can't make use of ActionBars. Please help me with the problem. It would be highly appreciated.
You will want to use the ActionBarSherlock library for this (which will allow you to use this all the way back to SDK version 4).
It is reasonably easy to style, and is for sure the right way to do this. Lots of examples for this, as it is a very popular library.
http://actionbarsherlock.com/
If you are wanting to target min API 4, then as you state you'll be unable to use the ActionBar.
So you could just create your bar as a LinearLayout or something with whatever buttons / icons you want on it and have it at the top of all of your Activities. If you have many of them it would probably be worth it to refactor the Bar (click handlers and such) handling into a subclass of Activity, and then extend that with all of your other activities.
The visual effect could be easily achived with a 9-patch png set as the background of a LinearLayout. Just make the gradient you want in photoshop/Gimp and drop it into draw9Patch to add the pixels on the edge that will allow it to stretch nicely to fit any screen.
Edit: using actionbar sherlock as others suggested is probably a better idea than doing it "manually" as I suggested.
Recently I became the proud owner of an Android 4.0 tablet and have been snooping around trying to create some apps. Now that I have the basics covered, I'm diving more into the "what's good/what's wrong" parts.
As far as I understand, the old "menu/settings"-button is deprecated (in the sense that you shouldn't use it anymore) and now the ActionBar is the way to go. Upon reading further, I came across this: http://developer.android.com/resources/samples/ActionBarCompat/index.html
It shows how to use the ActionBar on pre-API 11 systems. On the left you can see the typical menu where all options are shown a developer decided weren't important enough to be in the actual UI (the "wrong" way, but programmed using the newer ActionBar API). On the right, that same menu is now on the ActionBar.
My question is: Since it's been said such an "overflow"-menu is bad design on older mobile devices, is it also bad design when it's on the ActionBar as a button like shown on the right screenshot? Or is it only considered bad design because on a lot of devices it required you to press a physical off-screen button which makes it a non-issue when it's a virtual button on the ActionBar?
In short: Should I avoid it or not? Frankly, I like the idea of having a menu on the far right with all options that either don't fit or aren't important enough to be their own entity on the ActionBar.
Please also point out if any of the information I gathered and explained here is wrong.
The options menu hasn't been removed, it's just moved. It used to be hidden "behind" the Menu button on the device, but it's now moved to the ActionBar. Items on the menu either show as icons on the ActionBar, or on the overflow menu. You use exactly the same code to add items, whether to the old style menu, or the new style ActionBar.
A big part of the improvement that's been made is there is now a visible button on the top-right of the screen to open the "menu" (ActionBar overflow), which is right next to the other options. this is much better than before where the menu button had no visual connection to the app.
I suggest you look at ActionBarSherlock, http://www.actionbarsherlock.com, as it makes it pretty easy to add the full ActionBar to pre Android v3.0 devices.
http://developer.android.com/design/patterns/actionbar.html
Finally, I'd suggest that you follow the UI guidelines from Google. If they say the ActionBar is the right approach for navigation, then use it. It's best to use the provided UI patterns, and focus on the domain-specific stuff in your app.
Is there any way to change the content of the title bar when it's in Tab(If it wasn't in tab I would have done it but tried couldn't find any solution). E.g. Suppose I have created a custom title bar with few buttons on it, and now I want to change the content of the title bar(Drawables, Title and the functionality).
It would be great if someone could tell me if i can implement Action bar in versions below 3.0 ? I am creating this project in 2.1 (I'd like to create action bar from scratch).
or if there's any way beside inserting an image and placing buttons on it(This methodology would be good enough)?
If you're just looking to implement the ActionBar paradigm in pre-Honeycomb versions of Android, I suggest you look into using the ActionBarSherlock library.
The library will automatically use the native action bar when
available 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 back through 1.6.
twaddington and pjco's answers are correct, you need to use ActionBarSherlock if you want to be compatible with every SDK levels.
I want to add you can have a custom actionbar or a custom view for your actionbar tabs using the method actionbar.setCustomView(view) or tab.setCustomView(view)
Anyway, play with ActionBarSherlock demos, there are a few cool use cases.
The other option worth looking at is ActionBarCompat, which I think comes with the SDK 14 api demos. However, ActionBarSherlock seems to support many more features so that may be the better solution.