When I set the theme, it doesn't update on device
What I want is for my app to have that "zoom-in" animation used by, e.g., Google Maps, so when you start the application you get an instant title screen animation. I did this successfully in one title, but changing an existing app to do this has proven...complicated...and so I'm wondering what magic I managed in the previous app didn't make it into the new app.
I have a theme defined like this:
<style name="startstyle" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen">
<item name="android:background">@drawable开发者_StackOverflow社区/recharge</item>
</style>
Where there's a recharge.png in res/drawable.
In a file "theme.xml" in res/values, and I reference it like this:
<activity android:name=".MainActivity"
android:theme="@style/startstyle" <!-- more ... -->
</activity>
When I was working on another app, I had to uninstall and reinstall the app to get changes to the theme to actually ever show up. Then once it showed up, it always worked.
But the new application never does the zoom, though on the very first run on a particular device it DOES show the "recharge.png" image. But then later (even after killing the app) it doesn't show it again; it just cuts to a black screen before showing the title screen. OK, more testing shows that if I kill the app, wait 10 seconds, and then run again, I can get recharge.png to show again, but it never does the zoom animation.
It doesn't seem to always update when I change the theme, either, so I have to suspect that there's a cache that needs to be cleared.
My app is NDK-based, and the app itself does all its rendering in OpenGL, but it seems like the "zoom" animation should be happening before my app even gets full initialized. Am I wrong? Am I killing it by starving the CPU, for instance? Thoughts?
I was never able to track this down with any level of certainty, but it seems like I was running into a few different things:
- Sometimes the information is cached for an indeterminate period of time.
- The "zoom in" effect doesn't work on Android when you have a landscape-only app (a game) and it's zooming out from portrait mode.
- Eclipse sucks, and sometimes doesn't notice that things are changed unless you refresh before building. And sometimes F5 isn't even mapped to refresh, so even when you hit F5 to refresh your project (even after clicking on the project!) it won't refresh. I've verified this by right clicking and seeing that the "F5" shortcut is sometimes missing from the right-click menu.
精彩评论