问题
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.
Is there such a style/theme?
回答1:
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.
回答2:
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.
回答3:
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
回答4:
You can create a custom theme that inherits Holo Light and removes the title bar.
Add the following to the 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.
回答5:
Try this (see http://javatechig.com/android/actionbar-with-custom-view-example-in-android for a full tutorial):
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);
}
回答6:
just use Theme.Holo it's fullscreen and with action bar :)
来源:https://stackoverflow.com/questions/10134627/is-there-a-theme-for-holo-full-screen-but-with-action-bar