Hide App name and it's bar

匿名 (未验证) 提交于 2019-12-03 08:52:47

问题:

I've been trying to remove this bar (cant hotlink images, yet, check next link):

http://i.imgur.com/fRvMW.png

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.)

回答1:

Have you tried this?

ActionBar actionBar = getActionBar(); actionBar.hide(); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!