如何在 Android 中更改为全屏时删除状态栏动画

发布于 2025-01-06 09:25:07 字数 72 浏览 2 评论 0原文

当我将活动更改为全屏时,状态栏会执行 动画,但不会立即消失。那么我怎样才能使 状态栏立即消失?如果需要改变框架,在哪里 它?

when i change my activity to fullscreen, the statusbar performs an
animation,but not disappear immediately. so how can i make the
statusbar disappear immediate ? if need to change framework , where is
it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

泪意 2025-01-13 09:25:07

尝试在清单文件的活动标记中添加 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

编辑:

在调用 setContentView () 进行设置之前,在 onCreate() 中使用 requestWindowFeature(Window.FEATURE_NO_TITLE)以编程方式。

try android:theme="@android:style/Theme.NoTitleBar.Fullscreen" in the activity tag in your manifest file.

Edit:

Use requestWindowFeature(Window.FEATURE_NO_TITLE) in your onCreate() before you call setContentView () to set programmatically.

千年*琉璃梦 2025-01-13 09:25:07

我已经找到解决方案。

我们可以在我们正在创建和启动 Intent 的活动中输出以下代码,

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Intent scanIntent = new Intent(this, SecondActivity.class);
startActivity(scanIntent);

这样它将首先隐藏状态栏,然后它将移动到下一个活动。

仅当您使用单实例进行第二个活动时才需要上面的代码。
否则你可以应用 Vineet Shukla 给出的解决方案

I have found solution.

we can out following code in activity from which we are creating and starting Intent

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Intent scanIntent = new Intent(this, SecondActivity.class);
startActivity(scanIntent);

By this it will hide status bar first then it will move to next activity.

Above code will require only when you are using single instance for second activity.
else you can apply solution given by Vineet Shukla

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