ActionBarStyleGenerator - how to use it? - android

So, I have tried to use ActionBarStyleGenerator. It generates all style.xml file and all its left is to somehow set it for the action bar. The problem is that I use support libraries (app support 2.1 android) and I have issues with setting action bar style.xml to it.
Have you ever tried using this tool. If so, can you help me out and explain how to set style for the action bar?

The problem is that I use support libraries (app support 2.1 android) and I have issues with setting action bar style.xml to it.
You can set it to generate the resources for ActionBarCompat or ActionBarSherlock as well.
Since you are using the support library you have to choose AppCompat:

Related

Why android:showAsAction doesnt work and app:showAsAction does?

I've been stuck for a really long time with my app actions not showing as icons and finally I realized that some had the tag app:showAsAction="always" and some other had android:showAsAction="always", but the ones who worked were those ones with the app prefix. Could somebody whats the reason for this to happen this way?
The appcompat-v7 action bar backport -- ActionBarActivity and kin -- are designed to work on devices going back to API Level 7. android:showAsAction was only added in API Level 11. Hence, appcompat-v7 cannot readily use it. As a result, it defines its own custom menu attributes as replacements.
If you use the native action bar, you use android: attributes for everything. If you use appcompat-v7, you will use the app: attributes where needed and android: ones elsewhere.

How to do the compatibility mode for below android versions?

I am developing a android application.i am using action-bar in my app.but its not working in my Android smartphone(2.2.3) crashing. give me the solution.
Use actionbar sherlock for supporting lower versions too.. follow this
Here is how to use ActionBarSherlock:
Download the ActionBarSherlock here.
Assuming you're using Eclipse IDE, right click your Project, click Properties, then Android. At the bottom, in Layout, Add ActionBarSherlock.
Make sure ActionBarSherlock and your Project are in the same directory.
Extend your classes to Sherlock naming. For example, instead of Activity, change it to Sherlock Activity. The main documentation of ActionBarSherlock is found here.
For easier usage of Sherlock, create util methods in changing the Sherlock names and modifying it.
If you just need to know ocally the android version and act according to it :
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
// do something
}
else {
// do something else
}

Android customize action bar with api<11

how can I customize my action bar with api<11? I can't use actionBarSherlock because I got an issue related to my custom rom...is there a way to do that?
You can go For sherlock Action bar. here is link for the same
Here is detailed info on how to implement it
Make sure your project uses Android 4.0+ as the build target and that
you have the compatibility/support library added. (You can
right-click the project, select Android Toots > Add Support Library)
Download the ActionBarSherlock library project and import it into
Eclipse.
Right-click your main project, select Properties, and select Android
in the left pane. In the bottom half of the window, click the Add
button and select the ActionBarSherlock project. Click OK.
Instead of using regular Activities and Fragments, you use ones from
the Sherlock Library. They have the same names, but prefixed with
"Sherlock" (SherlockActivity, SherlockFragment, etc.)
To access the actionbar in code, you call getSupportActionBar(). This
returns either the regular actionbar (for Honeycomb and later) or the
Sherlock actionbar (for pre-Honeycomb).
Theming instructions are on the ActionBarSherlock website.
You can set android:minSdk in android manifest to lower sdk say 2.2 but built have to build in target 4.
So, it will work on handsets with api level < 11.
Hope it helps.
You have to write your own ActionBar

Implementing Holoeverywhere theme without ActionBarSherlock in my Android app

I am trying to implement the holoeverywhere theme in my app.
When I implement the holoeverywhere theme, I get a actionbar by default. I think it is because of Actionbarsherlock library. I was not aware of this library and have implemented my own actionbar of sorts. So, how do I disable the actionbar that comes up now.
If you need any relevant portions of my code, please let me know. Thanks
Removed ABS depends from HoloEverywhere... It's hard and don't supported by me.
First. Remove full library/src/com/actionbarsherlock from HE.
Second. Change library/resources/*.json to extend from standart android themes, not sherlock. Rebuild styles by mvn resbuilder:styler
Third. Remove fake-actionbar from PreferenceScreen code.
Fourth. Edit library/src/org/holoeverywhere/app/Activity and remove all related to ABS and remove Sherlock addon.
Fifth. Uncomment special block in library/res/values/attrs.xml. Straight from the top.
Sixth. Pray to Cthulhu and make a couple of tricks ears.
Once there was a branch nosherlock. Not popular.
In the HoloEverywhere library included in my project, in the res>values>styles.xml file, there is a theme called Holo.Theme.Light.NoActionBar. I use that instead of Holo.Theme.Light which I used earlier. This fixed the issue. Thanks.

Custom Title bar & Tabs

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.

Categories

Resources