隐藏应用程序名称,它的酒吧 [英] Hide App name and it's bar
问题描述
我一直在尝试删除这个栏(不能热链接图片,但是检查下一个链接):
但是我可以'
尝试以下内容:
添加到清单中:
android:theme =@ android:style / Theme.NoActionBar
但是导致崩溃。可能是因为我没有这个主题。我不知道这里应该写什么。
还尝试通过图形布局在每个片段上手动删除,选择无操作栏,它不' t显示在预览,但它显示在应用程序,可能是因为它错误的地方来配置它。
请注意,它是与碎片。我搜索了通过代码进行的操作,但是我刚刚找到了可以进行活动的选项。
所以,我的问题是:如何隐藏App Action栏? / p>
编辑:
SOLVED
在我的代码,我有这个:
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.setDisplayOptions(0,ActionBar.DISPLAY_SHOW_TITLE);
所以刚刚添加:
bar.hide();
一切都正常。即使没有显示标签名称,导航仍然有效(右侧和左侧用于交换片段)。
有你试过这个?
ActionBar actionBar = getActionBar();
actionBar.hide();
I've been trying to remove this bar (cant hotlink images, yet, check next link):
But I can't achieve it.
Tried the following:
Added into manifest the following:
android:theme="@android:style/Theme.NoActionBar"
But resulted as crash. Probably because I don't have this "Theme". I can't find out what should I write here.
Also tried to remove manually on each Fragment by Graphical Layout, selecting "No action bar", and it doesn't show up on the "preview" but it's shown in the app, probably because its the wrong place to configure it.
Note that it's with fragments. I searched about doing it by code, but I just found options to do it for activities.
So, my question is: How can I hide the App Action bar?
Edit:
SOLVED
On my code, I've this:
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
So, just added:
bar.hide();
And everything is working. Even if the tabs names aren't shown, the navigation still works (Swaping right and left for swapping fragments.)
Have you tried this?
ActionBar actionBar = getActionBar();
actionBar.hide();
这篇关于隐藏应用程序名称,它的酒吧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!