当我设置主题时,它不会在设备上更新

发布于 2024-10-18 14:19:47 字数 995 浏览 1 评论 0原文

我想要的是我的应用程序具有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感情旳空白 2024-10-25 14:19:47

我从来没有能够以任何程度的确定性追踪到这一点,但似乎我遇到了一些不同的事情:

  • 有时信息会被缓存一段不确定的时间。
  • 当您有一个仅横向的应用程序(游戏)并且它从纵向模式缩小时,“放大”效果在 Android 上不起作用。
  • Eclipse 很糟糕,有时除非您在构建之前刷新,否则不会注意到事情发生了变化。有时 F5甚至没有映射到刷新,因此即使您按 F5 刷新项目(即使单击项目后!),它也不会刷新。我通过右键单击并发现右键单击菜单中有时缺少“F5”快捷方式来验证这一点。

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文