I have problem removing this title bar/image:
I've tried theme change in manifest file
(android:theme="#android:style/Theme.NoActionBar.Fullscreen"),
and I've tried
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
aswell, but in both ways, my app "stopped working" right after I ran it. Any sugestions?
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.home);
in your your manifestchangelike this inplace of NoActionBar change to NoTitleBar
<application
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
The second try you made should be made before setting content
Works for me like this
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.login);
try this
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
add it after super.oncreate
You'd two ways to do this. As per my comment on your question.
First way is in your manifest file -
#android:style/Theme.NoTitleBar.Fullscreen
Second way is -
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.yourLayout);
If you're using multiple activities in your app. You've to give the style in first way to every activity. And, if you're choosing second way means, you've to give that requestWindowFeature to every Activity's inside and before of setContentView()
Hope these helps you and makes you understandable.
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'm developing a library where I have to set the window background programmatically and I can't use custom style XMLs. The idea is that the user who implements the library can set any theme he want - I just need to make the background transparent. So all the styles for the widgets will stay the same.
I tried some window flags like WindowManager.LayoutParams.FLAG_DIM_BEHIND and WindowManager.LayoutParams.FLAG_BLUR_BEHIND, but none of them was working.
Every solution that I've found is based on the style xml file.
Is there a way to set windowIsTranslucent directly from the code?
Thanks in advance, Roman
No, this is not possible.
It is only possible to set windowIsTranslucent in your theme.
Suggestion; Create your own theme that others can override.
android:windowIsTranslucent, android:windowIsFloating, and android:windowNoDisplay are all read exactly once, before your activity has even started. So by the time you're running your own code, it's too late.
http://osxr.org:8080/android/source/frameworks/base/services/java/com/android/server/am/ActivityRecord.java#0399
I used this
#Override
protected void onCreate(Bundle savedInstanceState) {
processSetTheme(this);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getWindow().setBackgroundDrawableResource(R.color.realTranslucent);
if (Build.VERSION.SDK_INT>=19){
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
super.onCreate(savedInstanceState);
<color name="realTranslucent">#00000000</color>
Here is trick:
First you use Translucent activity.
then you can set background of activity's layout file top layout.
is following both lines are
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
considering I am writing this line in activity class
hope it helps
requestWindowFeature(Window.FEATURE_NO_TITLE);
requestWindowFeature(Window.FEATURE_PROGRESS);
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