First, a theme MUST inherit from one of the standard ones.  If it doesn't,
some things won't work now, some things will break in the future, etc.

When an app is being launched for the first time, a preview of it is first
shown by constructing a window with the theme from its manifest and showing
that.  The delay from when that empty window is shown until the actual app
is faded in is the time it is taking your app to launch.  If you want to
reduce that, you need to profile and optimize your app's launch time.

On Fri, Oct 8, 2010 at 3:50 PM, Streets Of Boston
<[email protected]>wrote:

> When i create an activity that uses a custom-theme, e.g.
> android:theme="@style/MyLogonTheme".
>
> I create my theme in styles.xml:
>
> <style name="MyLogonTheme" parent="android:Theme">
>    <item name="android:typeface">sans</item>
>    <item name="android:windowBackground">@drawable/
> android_screen_logon_bg</item>
> </style>
>
> (note that i have a few more themes and plenty more styles in
> styles.xml, but they are not in use for this particular activity).
>
>
> When the activity is started brand new (e.g. after the process has
> just started), it starts VERY slowly:
> 1. The background (windowBackground) appears quickly, in a timely
> manner and the activity's 'setContentView' is called almost
> immediately in the onCreate.
> 2. However, the activity's content-view (setContentView) finally shows
> up 0.5 - 2 seconds later (depending on the speed of the phone)!
>
> When i remove the 'parent' from MyLogonTheme's definition:
> <style name="MyLogonTheme">
>    <item name="android:typeface">sans</item>
>    <item name="android:windowBackground">@drawable/
> android_screen_logon_bg</item>
> </style>
> Both the background and the content-view appear quickly!
>
> Somehow, including the inheritance from the "android:Theme" slows
> things down quite considerably.
>
> Why is this the case?
> Is there a way around it?
>
>
> I looked at the log... no special output that may indicate
> something... it is just slow.
>
>
> BTW:
> If i do remove the parent="android:Theme" part, things do load/show
> quickly, but i get quite a few warnings in the log. The warnings
> complain about layout_height is missing and some ColorStateList with
> TypedValue (0x2/0x1010059 a=-1) can not be found. They are just
> warnings... i see no other side effects.
> If i specify the parent="android:Theme", I don't get these warnings.
>
> Can I just remove the parent="android:Theme" part and live with the
> warnings?
>
>
> Thanks!
>
> --
> 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]<android-developers%[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.

-- 
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