当我设置主题时,它不会在设备上更新
我想要的是我的应用程序具有 Google 地图等使用的“放大”动画,因此当您启动应用程序时,您会获得即时标题屏幕动画。我在一个游戏中成功地做到了这一点,但事实证明,改变现有的应用程序来做到这一点......很复杂......所以我想知道我在上一个应用程序中管理的哪些魔法没有进入新应用程序。
我有一个这样定义的主题:
<style name="startstyle" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen">
<item name="android:background">@drawable/recharge</item>
</style>
res/drawable 中有一个recharge.png。
在 res/values 中的文件“theme.xml”中,我像这样引用它:
<activity android:name=".MainActivity"
android:theme="@style/startstyle" <!-- more ... -->
</activity>
当我在开发另一个应用程序时,我必须卸载并重新安装该应用程序才能真正显示对主题的更改。一旦它出现,它总是有效的。
但新应用程序永远不会进行缩放,尽管在特定设备上第一次运行时它确实显示“recharge.png”图像。但后来(即使在杀死应用程序之后)它也不再显示;它只是在显示标题屏幕之前切换到黑屏。好的,更多测试表明,如果我终止应用程序,等待 10 秒,然后再次运行,我可以再次显示recharge.png,但它永远不会显示缩放动画。
当我更改主题时,它似乎也不总是更新,所以我不得不怀疑有一个缓存需要清除。
我的应用程序是基于 NDK 的,应用程序本身在 OpenGL 中完成所有渲染,但似乎“缩放”动画应该在我的应用程序完全初始化之前发生。我错了吗?例如,我是否会通过 CPU 饥饿来杀死它?想法?
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/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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我从来没有能够以任何程度的确定性追踪到这一点,但似乎我遇到了一些不同的事情:
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: