当应用程序全屏显示时,tabhost 会隐藏
我在 Android 上使用 TabHost 和全屏应用程序时遇到问题。 我下载这个例子: https://github.com/AdilSoomro/Iphone-Tab-in -Android ,我在 onCreate: 上添加了这一行:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
但是当我在 HTC 手机上尝试时,选项卡被隐藏。如果应用程序未全屏显示,则不会发生这种情况。 您可以在此屏幕截图中看到它。
突然,当我按下另一个选项卡时,所有 TabHost 都会上升。 更奇怪的是,这只发生在 HTC 手机上,我测试过:HTC G1、HTC Hero、HTC Desire 和 HTC Desire HD,另一方面,在 Samsung Galaxy 3 和 S II 上我没有这个错误。
你知道问题出在哪里吗?我找不到任何相关信息。
谢谢。
I have a problem with a TabHost and a full screen app on Android.
I download this example: https://github.com/AdilSoomro/Iphone-Tab-in-Android and I add this lines on onCreate:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
but when I try in on my HTC mobile phone, the tabs are hidden. This don't happen if application aren't on full screen.
You can see it on this screenshot.
Suddenly when I press on another tab, all the TabHost go up.
The extrange is this only happend on HTC mobile, I tested on: HTC G1, HTC Hero, HTC Desire and HTC Desire HD, on the other hand, on Samsung Galaxy 3 and S II I haven't this error.
Do you know where is the problem?I could not find anything about this.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也遇到过同样的问题。我认为当标签栏位于底部时,android 在动画隐藏状态栏时不知道屏幕的大小。
最简单的解决方案是先隐藏选项卡栏:
tabHost.getTabWidget().setVisibility(View.GONE);
。然后在大约 600 毫秒后启用它:tabHost.getTabWidget().setVisibility(View.VISIBLE);
。如果您有拉伸的背景图像,这不是最好的,因为内容的高度会改变,因此图像会跳到新的尺寸。另一个解决方案是在应用程序启动之前创建闪屏活动。您需要将此屏幕设置为全屏。
这是一个链接,如何制作启动屏幕: http://www.codeproject.com/Articles/113831/An-Advanced-Splash-Screen-for-Android-App
我制作了一个全屏启动图像,需要将
finish()
放在startActivity(intent)
行之后。这为我解决了上述问题。I've had the same problem. I think android don't know the size of the screen while animating the hide of statusbar, when the tabbar is at the bottom.
The easiest solution is to hide the tabbar first:
tabHost.getTabWidget().setVisibility(View.GONE);
. Then enable it after about 600msec:tabHost.getTabWidget().setVisibility(View.VISIBLE);
. It is not the best if you have a stretched background image, because the height of the content will change so the image will jump to the new size.The other solution is to make a splash screen activity before your app starts. You need to make this screen full screen.
Here is a link, how to make a splash screen: http://www.codeproject.com/Articles/113831/An-Advanced-Splash-Screen-for-Android-App
I made a fullscreen splash image and needed to put the
finish()
afterstartActivity(intent)
line. This solved the above problem for me.您是否尝试过删除清单中的标题,而不是尝试删除代码中的标题?
欲了解更多信息,请查看:http://developer.android.com/guide/主题/ui/themes.html#PlatformStyles
Instead of trying to remove the title in the code, have you tried removing the title in the Manifest?
For more information checkout: http://developer.android.com/guide/topics/ui/themes.html#PlatformStyles