I've successfully got my application compiled into an apk file, and deployed to my Android devices.
But when I run it there, the notification bar is present and I'd like it to be fullscreen, without the notification bar.
This is the bar at the top of the screen, with the battery usage, wifi/3G connection, new email icon, etc.
How do we hide this in our compiled apps with Sencha Touch 2?
I have set fullscreen: true in the config of the first view which is loaded (the log in screen), and have also set:
Ext.application({
viewport: {
autoMaximize: true
}
});
You could change this in your AndroidManifest.xml:
<application>
<activity
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
...
</application>
You can actually modify the AndroidManifest.xml template in the SenchaCmd to get this, as explained in the Sencha forums.
That file will be in Sencha/Cmd/<CmdVersion>/stbuild/st-res/android/AndroidManifest.xml. You need to set the theme property on the application tag like this: android:theme="#android:style/Theme.NoTitleBar"
with the whole tag looking like:
<application android:icon="#drawable/icon" android:label="%s" android:theme="#android:style/Theme.NoTitleBar">
However, this solution is still extremely crappy and I'd love to see something that works without patching Sencha's code.
Simply add this to make the screen fullscreen this.setTheme(android.R.style.Theme_NoTitleBar_Fullscreen); before super.onCreate(savedInstanceState);
OR
add this.requestWindowFeature(Window.FEATURE_NO_TITLE); and
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN) before setContentView
For example:
#Override
public void onCreate(Bundle savedInstanceState){
/**sets Theme and Style (must be set BEFORE super.onCreate)*/
this.setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
OR
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
/**Changes Window. Removes title and/or notification bar (must be set BEFORE setContentView)*/
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
(Or you can do it via the Manifest as what homer_simpson said.)
Related
In my aplication only on 4.2 devices do that:
My activity manifest:
<activity
android:name=".CatalogListActivity"
android:label="#string/lbl_catalog"
android:theme="#style/Theme.AppCompat" >
</activity>
My onCreate:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cataloglist_activity);
getSupportActionBar().setBackgroundDrawable(null);
initControls();
checkCatalogs();
}
I found the bug
the previous activity (which was a splash screen), the theme was set as fullscreen. For some reason, when I called the other activity by intent, the bug described happened.
What I did:
I changed the manifest to:
android:theme="#style/Theme.AppCompat"
and added in onCreate of the SplashScreen:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Thanks!
I'm trying to hide the title bar on my app by putting the following code in the manifest file
android:label="Sound Board" android:theme="#android:style/Theme.NoTitleBar"
It looks to be working on my tablet, but not on my smart phone. My tablet is version 3.1 and the smart phone is 2.2
-Ted
I am not sure if that theme was available in api level 8 (2.2), but having following code in your Activity will provide the same result:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_layout);
...
}
I want to make full screen activity with no title bar and no status bar. I tried below mentioned code, it make activity full screen but status bar/notification bar is visible for few seconds and then hides.
Is there any way I can make activity full screen as soon as it appears to user.
Code Tried: I tried it on android 2.3 and 4.1.2
1) Progrmatically:
public class MyActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
2) Or via AndroidManifest.xml file:
<activity android:name=".MyActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
</activity>
Add the theme to your <application> tag in manifest.xml
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
You are using Theme.NoTitleBar.Fullscreen so please use Theme.Black.NoTitleBar.Fullscreen instead that as i mention below.
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
It works for me, hope it help to you...:)
You can simply do that by using WindowManager as you did but you just have to make change like;
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_semster_pdf);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Try to add the code as mentioned above or just check out at this link it will help you
http://www.codespot.info/2017/11/how-to-hide-status-bar-in-android-and.html
Got this app running in kiosk mode and would like to run it on full screen.
Already got rid of the application's grey title bar, but still got the home, volume, back and other buttons on the top bar as you can see in the picture.
The device is running android 2.2 firmware.
Any help is greatly appreciated!
So there is more approaches:
First, you should specify this feature in your Manifest.xml
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
Or in your onCreate method work both these approaches:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
or
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
The tablet you are running on is running a hacked version of Android, one that does not comply with the Compatibility Definition Document. As a result, you probably cannot get rid of that bar, unless you replace the firmware with something else.
The recommendations that the other provided is the right answer for compatible Android devices.
Make Your activity to look something like this in manifest
<activity
android:name=".HelloActivity"
android:label="#string/laptop"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
In android manifest use this line
<activity android:name=".yourActivityName"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen">
and in your class use this line in oncreate method
requestWindowFeature(Window.FEATURE_NO_TITLE);
this code works fine for android 2.2 i have tested and its working.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity);
I'm trying to do an Android-Tablet app for presentations on trade fairs etc. I don't want to upload the app to the app store, only use it on my tablet.
I try to run the app in ful screen mode (without status bar) with:
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Works great. I try to disable the home button with:
#Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
}
in my OnCreate-Method. Works great.
But if I try to use both in one app, only disabling the home button still works, any idea what i can do about this?
Thank you!
Try declaring the activity as fullscreen in AndroidManifest.xml, and then doing what you already do to capture the home button
<activity android:name="..." android:label="..."
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen" />