Full screen display in portrait/landscape mode in Android - android

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

Related

Hide the status bar,but my view does not go to the top

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

Android main activity title image removing

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.

Full screen transparent activity (no title & status bar) doesn't work.... why?

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);
}

Spinner click dropdown show status bar

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

full screen in android at runtime (no notification/status bar and app title bar)?

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

Categories

Resources