Android Holo 是否有主题,全屏但带有操作栏?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10134627/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a theme for Holo, full screen but with Action Bar?
提问by kishu27
I need to make an activity appear such that the activity remains full screen (no title bar) but with the Action Bar present.
我需要显示一个活动,以便该活动保持全屏(没有标题栏)但存在操作栏。
App uses Holo Light for its interfaces.
应用程序使用 Holo Light 作为其界面。
Is there such a style/theme?
有这样的风格/主题吗?
采纳答案by lrAndroid
Unfortunately, all built-in Holo Light themes with no title bar also have no action bar. Theme.Holo.Light.NoActionBar
has a title bar but no action bar, and Theme.Holo.Light.NoActionBar.Fullscreen
has neither the action bar nor the title bar.
不幸的是,所有没有标题栏的内置 Holo Light 主题也没有操作栏。 Theme.Holo.Light.NoActionBar
有标题栏但没有动作栏,Theme.Holo.Light.NoActionBar.Fullscreen
也没有动作栏和标题栏。
回答by WarrenFaith
I had the same "issue" and what I do is basically the good old way:
我有同样的“问题”,我所做的基本上是旧的方式:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
This combined with the normal Theme.Holo
results in an UI with Actionbar but no Notification area.
这与Theme.Holo
带有操作栏但没有通知区域的 UI 中的正常结果相结合。
回答by AlAsiri
Here are what you have to set to reach that:
以下是您必须设置的内容:
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
Good luck
祝你好运
回答by user3755767
You can create a custom theme that inherits Holo Light and removes the title bar.
您可以创建一个自定义主题,继承 Holo Light 并删除标题栏。
Add the following to the res/values/styles.xml
将以下内容添加到 res/values/styles.xml
<style name="My.Holo.Light.FullScreen" parent="android:Theme.Holo.Light">
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
Than set this style as the default theme for your application in the manifest xml.
然后将此样式设置为清单 xml 中应用程序的默认主题。
回答by Issac Balaji
Try this (see http://javatechig.com/android/actionbar-with-custom-view-example-in-androidfor a full tutorial):
试试这个(有关完整教程,请参阅http://javatechig.com/android/actionbar-with-custom-view-example-in-android):
private void actionBar() {
// remove title
// requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#bdbb35")));
actionBar.show();
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
View mCustomView = mInflater.inflate(R.layout.custom_actionbar, null);
//TextView mTitleTextView = (TextView) mCustomView.findViewById(R.id.title_text);
// mTitleTextView.setText("My Own Title");
actionBar.setCustomView(mCustomView);
actionBar.setDisplayShowCustomEnabled(true);
}
回答by Meisam
just use Theme.Holo it's fullscreen and with action bar :)
只需使用 Theme.Holo 它是全屏的并带有操作栏 :)