Thanks, Dianne.  I thought there might be a better way.  Does this
work down to API level 4?

I am not sure I understand the point of your comment about the
targetSdkVersion.  Of course, I have it defined as 11 (actually 12).
Otherwise I wouldn't need to mess around with the Holo stuff.  Maybe I
am missing your point?



On May 19, 12:46 am, Dianne Hackborn <[email protected]> wrote:
> 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 <[email protected]> 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> 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.- Hide quoted text -
>
> - Show quoted text -

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

Reply via email to