use holo theme on Android < 4.0 - android

I'm developing an app for Android 2.2 and higher.
I use the great ActionBarSherlock (thank you, Jake Wharton !!) to use the action bar on pre-ICS devices.
While the actionbar looks great, all other gui elements have the look of the default theme of the device (in my case HTC Sense 3).
Is there a possibility to style my (>= Android 2.2) app on all android devices with the Holo.Dark.Theme?
I compile my app with Android 4.0.3, the minSDK version is 8.

Enjoy HoloEverywhere, that's the whole purpose of the project!
(Edit) new adress: https://github.com/Prototik/HoloEverywhere

No. That would require a back port of the complete Holo theme and styling, which Google chose not to do. It would also be a rather ambitious undertaking and I would think it is out of scope of the ActionBarSherlock project, whose focus is on ActionBar compatibility.
The best you can do is cherry pick the resources you most want from the ICS source and create your own custom theme/styles.

Related

AppCompat Library Disadvantages

I'm a new Android developer who is trying to find the best balance for API level support. I think my indecision stems from a lack of understanding of the benefits and disadvantages of using the AppCompat Library over newer Android features such as Holo themes and the action bar.
Of course, I know that Holo is unavailable before API Level 14 and the Action Bar is unavailable before API Level 11. If I want to make my apps available to the broader Android userbase, I will need to lower my minSdkVersion and use the AppCompat Library.
My question is, are there any significant recent features of the Android OS that just aren't supported or are unable to be implemented through the AppCompat Library? Adding on to that, if you set your minSdkVersion to say API Level 7 and build your app with support for AppCompat (say, with your app themes being Theme.AppCompat.Light), will devices running an API greater than 11 or 14 for example use default Holo or action bar features or be restricted to AppCompat? I'd like to know if supporting older APIs will disadvantage users with newer and more capable devices.
Anyway, regardless of the outcome, I'll probably still go for supporting say API 7-8. This is more of a curiosity question on my part. I hope it makes sense!
Thanks, Klep
AppCompat should add functionality of the latest API to older APIs when needed. For instance, lollipop added the CardView class, which can be used in older Android APIs when AppCompat is used, with some minor differences (some of the Android L animations may not apply on older versions of Android for example). It is recommended to use AppCompat in most cases, since more users will be able to run your app when you do (depending on your MinSdkVersion). If you want to know what classes you can access in AppCompat, you can take a look at the features here.
Regarding the Styles: through Platform.AppCompat style the Theme.Appcompat inherits, and then overrides some properties, from Holo (11+) or Material (21+) if these are native on the running device.

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

Android ICS Skin for our applications

Is there a easy way to have our application look like ICS or JB?
Mainly the slider and the radio button. They look old when displayed in green.
Any hint about this?
There's a nice package available on github called HoloEverywhere.
One thing though, do not try pass it off as a ICS/JB Application, just because it "looks" like the user interface one would expect to see in a native ICS/JB Android set up.
Best that can be done with the project, is to target the latest SDK to guarantee your wide-market of Android usage, including GB.
Aim high, not low ;)
The best way is to use the Android Library 'Actionbar Sherlock'. This Library uses all native ICS Themes, etc for older devices.
ActionBarSherlock is an extension of the compatibility library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.

Using support classes in new versions of Android

If I'm trying to make my App work on older devices, I use the Support Libary and ActionBarSherlock.
Of Course, they also work on newer devices. But should i use them on new OS versions, or change the code and resource files so that 4.0 devices for example all use the stock classes and not the support ones.
For example (pseudocode):
if (running 4.0+){
ActionBar= getActionBar();
}else{
ActionBar= getSupportActionBar();
}
or just use this one on all versions:
ActionBar= getSupportActionBar();
What are best pratices, and does that affect stability and perfomance ?
You answered yourself already: "Of Course, they also work on newer devices". If it works then it works. Compatibility lib is just portion of Android framework separated from Honeycomb+ code and offered as .jar for use on older devices. If you target older devices, with pre 3.x Androids and HC+ devices at the same time, then if you still want to use fragments and stuff you got no other choice anyway. And you also need compatibility library for ActionBarSherlock, as it needs it as well.
As far as I know, ActionSherlockBar itself automatically switches everything based on the OS version. So you don't need to bother.
I have used it in my application and it works pretty much the same both on 2.3.7 and 4.0.
This is from its website:
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.

ICS style in Froyo and Gingerbread Apps

I am developing an application for Android and I'm using the API level 8. However I would like this app would use the theme of ICS when running on Froyo and Gingerbread because the theme of the ICS is much more beautiful. I wish that at least the color scheme and shape of the buttons were equal. Is there any way to do this?
The first thing you might want to look at is ActionbarSherlock as it adds a lot of consistency to your pre-ics code, even though this is not directly related to the theme.
Then take a look at the HoloEverywhere project on GitHub for using the Holo theme on apps designed for pre-ics devices.
The best i found is android-holo-colors in which you will get all the controls and also can choose holo-light or holo-dark with custom colors you want.
I hope this will help you
The SDK folder contains most of the themes, styles and drawables used in ICS. Check
SDK folder\platforms\android-15\data\res.
You can apply themes/styles in your app like this

Categories

Resources