You actually don't need to do something that complicated.  You can just
define your own custom theme that switches based on the API version...   hm
I thought this was documented, but maybe I saw it in some newer in-progress
documentation.  Anyway, just define a theme that inherits from the pre-v11
theme you want:

<style name="MyTheme" parent="@android:style/Theme" />

Then in a values-v11/styles.xml file define a different version that uses
the v11 theme:

<style name="MyTheme" parent="@android:style/Theme.Holo" />

Also, if you are using the Holo theme you *really* should be setting
android:targetSdkVersion="11" or greater, since using Holo means you know
about the newer platform version and want it treating you as a modern app.
 This includes removing the menu button, amongst other things.

On Wed, May 18, 2011 at 5:21 AM, Zsolt Vasvari <zvasv...@gmail.com> wrote:

> > 1. On API Level 11+, use a version of the activity that isn't themed
> > as a dialog. I hoped you could use <activity-alias> for this, but it
> > doesn't seem like you can override a theme that way...
>
>
> What I do is the following:
>
> public class MyActivity extends Activity
> {
>    public static class MyActivityNoHolo extends MyActivity
>    {
>        // Nothing
>    }
>
>
>    public static class MyActivityHolo extends MyActivity
>    {
>        // Nothing
>    }
> }
>
>
> Give them different themes in the manifest and then use the
> appropriate class name when starting the activity as determined by the
> API level.
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to