I am using spinner in my applicaltion. In my app Android title bar and notification bar is hidden.
But when i click on the spinner the hidden notification bar is visible for a fraction of a second. Here is my code:
Main.java:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Hide the Title Bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
// Hide the Notification or Status Bar
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.myActivity);
main.xml:
<activity android:name=".YourClassName"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"/>
}
But still i cant solve this problem.. If anyone has any solution please let me know.
If you are using tablet resolution then it will not work.
Try putting
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
in the application like this
<application android:icon="#drawable/icon" android:theme="#android:style/Theme.NoTitleBar.Fullscreen" android:label="#string/app_name">
thanks
Related
I want to remove this unwanted title bar
I cant remove this
i have tried
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
This is not a title bar. This is ActionBar or Toolbar. You should extend your application theme from Theme.AppCompat.NoActionBar. Or just add android:theme="#style/Theme.AppCompat.NoActionBar" to <application/> tag in AndroidManifest.xml
add the following to your manifest:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
That should sort it, replace Theme with your actual theme if required, this line goes within the application part of the manifest or can go where the activity is declared.
You need to set your content view AFTER you have written the two lines
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//set content view AFTER ABOVE sequence (to avoid crash)
this.setContentView(R.layout.layout_name);
is it possible to hide status bar:
And show action bar without it?
try this..
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Another way .In your manifest xml, at application level set this:
<activity
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" />
I hope it will works
I use
mContext.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
mContext.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
mContext.getWindow().getDecorView().requestLayout();
to hide the status bar after setContentView.
The status bar is hided,but my view does not go to the top.There is a black rectangle
instead of the status bar.
You can use this in the Manifest file of that particular activity. remove above code from java file and put below code in Manifest in the activity
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
here is the solution : just check it out
// hide titlebar of application
// must be before setting the layout
requestWindowFeature(Window.FEATURE_NO_TITLE);
// hide statusbar of Android
// could also be done later
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
For hiding the status bar please add request feture with no title and flag as full screen then
add the content view.
Code is
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_test);
And for only the notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
I'm making a custom lock screen.
The lock screen is an activity which I launch by the time the screen goes off.
However, I can't make the activity be both transparent & fullscreen.
The Status bar keeps showing.
Here's what I do in the manifest:
<activity android:name=".activities.LockScreenActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
I'm also adding these extras in activit's onCreate:
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.lock_screen);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
But it can't seem to work :|
why?
delete the code from onCreate(). use this in Manifestfile.
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"
otherwise create the theme according to your requirement.
You Need to set flags before setContentView, it should work fine then
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.lock_screen);
Here is it link (Hide the Status Bar on Android 4.1 and Higher).
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
actionBar.hide();
Hide the Status Bar on Android 4.0 and Lower:
<application
...
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen" >
...
</application>
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// If the Android version is lower than Jellybean, use this call to hide
// the status bar.
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
setContentView(R.layout.activity_main);
}
I am using VideoView component for streaming video in Android, but I am not getting the full screen display.
Kindly provide the code to display full screen in portrait/landscape mode.
modify either your AndroidManifest.xml
<activity android:name=".YourClassName"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"/>
or your activity
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// get rid of title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
// hide statusbar
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
Set theme as FullScreen, Hide title bar