如何在 android 应用程序中的 运行 时间隐藏(或删除)操作栏

How to hide (or remove) Action Bar at run time in android application

我已经创建了一个应用程序。有一个登录 activity 所以我只想在运行时删除操作栏。 我该怎么办???

您可以在图中看到蓝色的操作栏。我只想删除这个。

谢谢

如果您使用的是 AppCompatActivity,那么您可以执行以下操作:

// to hide the action bar
getSupportActionBar().hide();
// to show the action bar
getSupportActionBar().show();

如果您使用的是Activity,那么您可以执行操作:

// to hide the action bar
getActionBar().hide();
// to show the action bar
getActionBar().show();

注意:此作品仅供您使用 Theme with Action Bar.