Trying to hide the title bar on my Android app - android

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

Related

How to set app title as up in Android 4.0 & 4.1

I have an app which should work on android 4.0 and up. When I try the app with my Samsung Galaxy S5 (Android 4.4.2), everything looks fine. I can press the activitie's title to go back. But on Android 4.0 and Android 4.1, I can only press the arrow left to the activie's title. But the title should be clickable, too. How can I do this?
In the activiy, I call this:
public void onCreate(Bundle savedInstanceState) {
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.txt_publication_back);
}
And the relevant part of the AndroidManifest looks like this:
<activity
android:name="views.activies.EditionActivity"
android:label="#string/txt_window_editions"
android:parentActivityName=".views.activies.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.activies.MainActivity"/>
</activity>
Any help would be appreciated! Thank you!
logically it should work until and unless you have specify some thing like code below.
getActionBar().setDisplayShowCustomEnabled(true);
getActionBar().setCustomView(R.layout.custom_actionbar);
Here the title is not clickable but in ur case I am not able to get.
Still with workaround we can achieve
int actionBarTitleID = getResources().getIdentifier("action_bar_title", "id", "android");
findViewById(actionBarTitleID).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// do ur logic
}
});
I don't know exactly how much it can help you...

Android 2.1 Tablet Fullscreen app

I need to launch appliaction in fullscreen mode (or just not leavable) on Wooky Reader tablet (it is most likely the same as Archos 70b), which runs on Android 2.1.
I've made some tries that did not work:
in manifest:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen
i've add permission:
uses-presmission android:name="android.permission.STATUS_BAR
just for the case.
In code i tried:
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
setContentView(R.layout.main);
And combinations of these.
I know that removing status bar is "prohibited" on tablets, but i've found some ways for Android 3.0+ versions. So is there any way to do that on this specific tablet?
I will be glad for any ideas.
EDIT: now i tried:
uses-permission android:name="archos.permission.FULLSCREEN.FULL"
-> did not work

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

Android app full screen

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

"No such resource" setting activity's theme

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

Categories

Resources