"No such resource" setting activity's theme - android

I want to display a picture full screen without an action bar in Android tablet, but when I write android:theme="#android:style/Theme_NoTitleBar_Fullscreen" in Android Manifest, it says there is no such resource. How is it possible since it is on the list of themes?

You should use:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"

you can use this
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

Related

Android 4.2 Title Bar over Action Bar

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!

Trying to hide the title bar on my Android app

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

How to set activity to fullscreen mode in Android? [duplicate]

This question already has answers here:
Fullscreen Activity in Android?
(40 answers)
Closed 9 years ago.
How to set full screen mode for activity in Android? I am using the following code to set full screen but it generates an error:
Exception:
android.util.AndroidRuntimeException:
requestFeature() must be called before adding content.
Code:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
please check the code
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);
}
and note it is set before setting the content view
try this in AndroidManifest:
<activity android:name=".ActivityName"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
</activity>
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
put requestWindowFeature first in your code....like this...
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

Hide the Android Notification bar on a Sencha Touch 2 app

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

How to disable status bar / notification bar on android programmatically?

i create a lockscreen application.. this application is triggered by SMS.. when a SMS containing command was received, it will display a lock screen activity.
my lockscreen activity is using TYPE_KEYGUARD for disabling a home screen button. When device screen turn off and then i turn it on again, my problem is status bar / notification bar still appear on my screen. this is a problem because the user still can access some program through status bar / notification bar even the device is being locked. so i want to dissapear this status bar / notification bar so that the user (theft) can't access that device anymore..
Please help me to solve this..
I think what you're trying to do is programmatically set an activity as fullscreen. If so, consider the following:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Source: http://www.androidsnippets.com/how-to-make-an-activity-fullscreen
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
}
requestWindowFeature(Window.FEATURE_NO_TITLE);
only disables the activity's title bar, not the notification bar at the top.
Use this theme in android manifest for your activity :
"Theme.NoTitleBar.Fullscreen"
did work for me.
It hides the notification bar.
On Android 4.0 and lower
Option 1:
<application
...
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen" >
...
</application>
Option 2:
public class MainActivity extends Activity {
#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);
}
...
}
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();
And for Android 4.6(Api 19) and higher use the Immersive Full-Screen
Mode
Reference from Google

Categories

Resources