How do I do this? Any suggestions? BTW I am using SDK with AIDE.
Go into the manifest and use a full screen theme.
<activity
android:name=".Foo"
android:label="#string/foo"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
This code makes the current Activity Full-Screen. No Status-Bar or anything except the Activity-Window!
public class FullScreen 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);
}
}
Edit for AppCompactActivity
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/orange</item>
<item name="colorPrimaryDark">#android:color/holo_orange_dark</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
If you want a full screen put this attribute in <activity /> or <application /> tag in your Manifest file
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
Agree with the above answer given by SquiresSquire. Just adding little more information in the answer i would like to present my answer.
You can make your application full screen in two ways,
Making Full Screen any particular Activity
add theme element in activity tag
<activity
android:name=".YourActivityName"
android:theme="#android:style/Theme.NoTitleBar.">
Making Full Screen whole application
add theme element with application tag
<application
android:icon="#drawable/icon"
android:theme="#android:style/Theme.NoTitleBar.">
To set your Application or any individual activity display in Full Screen mode,
Insert the code in AndroidManifest .xml file
#android:style /Theme. NoTitle Bar.Fullscreen
This works well for me.
android:theme="#style/Theme.AppCompat.NoActionBar"
Related
I need to create application wihtout actionbar. I will try to explain how I create application(maybe I am missing some steps).
1.I am intentionally not choosing "Holo Light with Dark Action Bar" option. I thought this make application without action bar.
2.Leaving next page as default:
3.Leaving next page as default:
4.On the next page, it becomes interesting. Blank Activity's description says that it creates a new blank activity an action bar. On Empty Activity's description: Creates a new empty activity. So I choose Empty activity
5.Leaving next page as default.
Result:As usually, application was created with ActionBar.
Tried this solution:getActionBar().hide();. In this solution, ActionBar is hiden after some milliseconds.
Tried to use android:theme="#android:style/Theme.NoTitleBar" in AndroidManifest.xml->application tag. But in this solution, application uses old theme.
My question: how to create Android application without ActionBar using new theme and leaving StatusBar enabled?
PS. I remember, about one year ago, in Eclipse, applications were created without ActionBar. Then we added it manually
Put this right after super.onCreate(savedInstanceState); in the onCreate method of your activity(s):
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Make sure you put this BEFORE this.setContentView(R.layout.activity_example); to avoid crashes
When your project is started you can use public activity extends Activity instead of using ActionBarActivity this will also remove the action bar or there is another way
<android:theme="#android:style/Theme.NoTitleBar">
or you can see these links they might help
How to hide action bar before activity is created, and then show it again?
Remove android default action bar
Refer this code and change as per your requirement:
Update :
styles.xml :
<style name="FullscreenTheme" parent="android:Theme.Holo">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:actionBarStyle">#style/FullscreenActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">#null</item>
<item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
<item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>
<style name="FullscreenActionBarStyle" parent="android:Widget.Holo.ActionBar">
<item name="android:background">#color/black_overlay</item>
</style>
These will remove actionbar and keeps your theme as it is .
Note : Here i have tested using Theme.Holo . you can use yours.
AndroidManifest.xml
<activity
android:name=".GridViewExample"
android:theme="#style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
It gives you activity without ActionBar.
Hope this solves your problem.
You can do it programatically:
public class ActivityName extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// remove title
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
Or you can do it via your AndroidManifest.xml file:
<activity android:name=".ActivityName"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"/>
EDIT :
If your app uses any other theme use corresponding theme name E.g. For White theme #android:style/Theme.Holo.Light.NoActionBar.Fullscreen
I want to know how to achieve this effect.
My app (default everything), when launcher icon is clicked, right away display some kind of a empty dummy window, where nothing is happening and then loads layout into it.
"Heavier" apps like YouTube, Drive, Dropbox etc. when started, seem to wait after launch, without showing that dummy window and load right into ready layout.
Any idea how to do this or where should I look into?
Thanks
//EDIT: this has nothing to do with something like loading database, where I should display progressBar, imho this has to do with stuff before activity exists.
I suggest you don't disable the dummy loading window using:
<style name="Theme.MyTheme" parent="android:style/Theme" >
....
<item name="android:windowDisablePreview">true</item>
....
</style>
because you could run into several problems. For example, if you try to animate an AlertDialog, enter animation will not work (personal experience).
The right solution is to set the theme of your application like to your main activity screen (same ActionBar style, same background color).
In my application after severals experiments i found the right solution for my needs.
(I have a main activity with blank background, no ActionBar, just full screen personal layout)
1 - styles.xml: add new style like this (remove ActionBar and set the same background color of my main activity)
<style name="LoadingTheme" parent="#android:style/Theme.Light.NoTitleBar.Fullscreen">
<item name="android:windowBackground">#color/white_smoke</item>
</style>
2 - AndroidManifest.xml: set my theme for main activity to "LoadingTheme"
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.company.appname.MainActivity"
android:label="#string/app_name"
android:theme="#style/LoadingTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
....
</application>
And finally i have full blank dummy loading window without ActionBar with soft MainActivity load and working animations.
Hope to be helpful.
<style name="Theme.MyTheme" parent="android:style/Theme" >
....
<item name="android:windowDisablePreview">true</item>
....
</style>
but use with caution
This will create a custom preview window for your activity.
Create a style in styles.xml like
<style name="MyTheme" parent="#android:style/Theme.Holo.NoActionBar">
<item name="android:windowBackground">#color/myBackgroundColor</item>
</style>
In your Manifest file use the theme created above.
For eg:
<activity android:name=".MyActivity"
android:label="#string/app_name"
android:theme="#style/MyTheme"
/>
In your activity change the background of the window back to null in onCreate()
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setBackgroundDrawable(null);
setContentView(R.layout.main);
}
You can call the setContentView method anywhere you'd like in your activity. Before calling this method it will display a blank screen. If you wanted a splash screen, you can call the setContentView method within the onCreate method to display the splash screen view. Then when you're ready to display the "main" view you can use a LayoutInflater to display it. I also suggest using a ProgressDialog to show the user that information is loading.
Load your resources before setting the contentview. There will be a dummy window until you would not set view using setContentView.
EDIT
To avoid this screen. Make there changes to your code.
1) Do not do any heavy work in activity onCreate method. Run a separate thread for it.
2) Set content view right after the super.onCreate() line
super.onCreate(savedInstanceState);
setContentView (R.layout.splash_screen);
3) Apply following theme to your application.
Define theme in style
<resources>
<style name="Theme.MyTheme" parent="android:style/Theme" >
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowBackground">#drawable/any_default_background</item>
</style>
</resources>
In your Manifest
<application
....
android:theme="#style/Theme.MyTheme"
....
>
Thats It.
When I created new Android application in Eclipse.In its AndroidManifest.xml the theme set to application isandroid:theme="#style/AppTheme"& style.xml is as follows.
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
</resources>
& my screen appears like this.
I want to remove the TitleBar from app but want to show the theme of Android 4.1's.
For this I tried
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar" >
Now my screen appears like this the TitleBar is removed but theme has changed.
Please help me to sort out this issue.
Use this instead : #android:style/Theme.Holo.NoActionBar.
Try out putting this in your manifest.
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
I am using following code to replace title bar.
final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
And it's working fine once UI loaded. Problem is however when I start the app, the ugly gray bar appears for 1-2 seconds until UI loaded. Is there any way to specify not showing the default title bar at all?
If you want the titlebar to be gone in every activity within your app, then add
<application android:name=".YourAppNameHere"
android:label="#string/app_name"
android:icon="#drawable/icon"
android:theme="#android:style/Theme.NoTitleBar">
to your manifest. Not 100% sure though that this will prevent the titlebar from showing up momentarily, but it should work.
In the Manifest file, add this line inside the application tag
android:theme="#android:style/Theme.NoTitleBar"
It will hide the bar from all the activities. If you want to hide it from a specific activity, add the same line to that activity's tag.
Good Luck !
You should add a line to your AndroidManifest which states that you use a theme (standard android or extended)
<application android:name=".YourAppNameHere"
android:label="#string/app_name"
android:icon="#drawable/icon"
android:theme="#style/MyTheme">
and then you can have a themes.xml in your res/values/ folder where you extend the: Theme.NoTitleBar and add custom rules to them (for example like windowBackground)
<resources>
<style name="MyTheme" parent="android:Theme.NoTitleBar">
<item name="android:windowBackground">#drawable/my_background</item>
</style>
<resources>
Have fun
I developed an application. I would like to remove space that is used
for showing application name on top of my application UI. (The Title Bar)
I set Application label as null In manifest File But it will not remove the space for showing Application name
Please tell me what is the correct or possible way to do that
Thanks in advance
You request window feature in your onCreate method:
#Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
}
or in AndroidManifest.xml:
<activity android:name=".YourClassName"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
i think you can add this line in you application tag in android manifest file
android:theme="#android:style/Theme.NoTitleBar"
For android studio:
In android AndroidManifest.xml file change the theme like: android:theme="#style/Theme.AppCompat.Light.NoActionBar"
example
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" >
you can use this style
<style name="MyTheme" parent="#android:style/Theme.NoTitleBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">#drawable/xyz</item>
</style>