How to Use Holo.Light Theme, and Fall Back to 'Light' on Pre-Honeycomb Devices

How to use Holo.Light theme, and fall back to 'Light' on pre-honeycomb devices?

You have to create a custom theme and save it in some directories to finally set this theme as the default one for the app

First, in values add a themes.xml like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Any customizations for your app running on pre-3.0 devices here -->
</style>
</resources>

Then, create a directory with the name "values-v11" (Android 3.0+ ) in the res directory and put a themes.xml like this

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on 3.0+ devices here -->
</style>
</resources>

Finally, create a directory with the name "values-v14" (Android 4.0+) in the res directory and create a themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<!-- Any customizations for your app running on 4.0+ devices here -->
</style>
</resources>

With the DeviceDefault your app allways look perfect in any device of any company (HTC Samsung ... ) that add created custom themes for Android 4

EDIT: Samsung's interface (TouchWiz) dont respect this feature and the apps will be very ugly on Samsung's devices. Its better put Holo theme :(

Finally in your manifest.xml

 <application
...
android:theme="@style/MyAppTheme">

animationlistener not working pre honeycomb devices

I had a similar issue and managed to solve it. I'm still not really sure what's the reason behind this problem, but it's lying somewhere around the content of the view and the way gingerbread handles its drawing.

In my case I had a RelativeLayout which had some views in it. The animation would work only if I changed some value of a child view in my RelativeLayout before calling the animation. For example, I had a TextView inside, so I would call the setText() method. Maybe you should try it too:

// ---
mQuickReturnView.setAnimation(toTopAnimation);
someViewInsidemQuickReturnView.setText(getResources().getString(R.string.some_string));
mQuickReturnView.startAnimation(toTopAnimation);
// ---

The setText() method updates the view in some way and the animation works fine after that.

AlertDialog theme problems

To set a different Theme for the alert dialog like Theme.Holo.Light try to use ContextThemeWrapper as used in Dialog.java in android source:

builder = new AlertDialog.Builder(new ContextThemeWrapper(this, android.R.style.Theme_Holo_Light_Dialog))

android- apply holographic theme to my app

If you follow the rules you can do this to maintain the theme of your app and the theme of the phone:

https://stackoverflow.com/a/9681744/628447

Other posibility is use this incredible page to make all your views

http://android-holo-colors.com/
(take a look of the main page http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html and all of the tools)

And the best solution is use this library:

https://github.com/Prototik/HoloEverywhere

Dark background in android app with no explication

try changing the Manifest re the below:

<activity
android:name=".YourActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Light.NoTitleBar">
</activity>

and look here

Custom preference broken in Honeycomb/ICS

I had similar problem with a third party custom preference and fixed it by making the widget frame visible. It was invisible by default in ICS. Dont' know how it maps to your custom preference.

// This line was in the original code.
LinearLayout widgetFrameView = ((LinearLayout) mView
.findViewById(android.R.id.widget_frame));
...
// This line fixed the visibility issue
widgetFrameView.setVisibility(View.VISIBLE);

Also had to realign the view to make it consistent with the rest of ICS controls.



Related Topics



Leave a reply



Submit