全屏透明活动(没有标题和状态栏)不起作用......为什么?
我正在制作一个自定义锁屏。
锁定屏幕是我在屏幕关闭时启动的一项活动。
但是,我无法使活动既透明又透明。全屏。
状态栏持续显示。
这是我在清单中所做的:
<activity android:name=".activities.LockScreenActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
我还在 activit 的 onCreate 中添加了这些额外内容:
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.lock_screen);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
但它似乎无法工作:|
为什么?
I'm making a custom lock screen.
The lock screen is an activity which I launch by the time the screen goes off.
However, I can't make the activity be both transparent & fullscreen.
The Status bar keeps showing.
Here's what I do in the manifest:
<activity android:name=".activities.LockScreenActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
I'm also adding these extras in activit's onCreate:
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.lock_screen);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
But it can't seem to work :|
why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
删除 onCreate() 中的代码。在清单文件中使用它。
否则根据您的要求创建主题。
delete the code from onCreate(). use this in Manifestfile.
otherwise create the theme according to your requirement.
您需要在 setContentView 之前设置标志,然后它应该可以正常工作
You Need to set flags before setContentView, it should work fine then
这是链接(隐藏状态栏在 Android 4.1 及更高版本上)。
在 Android 4.0 及更低版本上隐藏状态栏:
Here is it link (Hide the Status Bar on Android 4.1 and Higher).
Hide the Status Bar on Android 4.0 and Lower: