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>
Related
I am really frustrated right now and read a ton - maybe you can help me out.
Why is Android Studio still showing me "Main2Activity" with the titlebar?
Here is my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.martin.myapplication">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Main2Activity"
android:theme="#android:style/Theme.Light.NoTitleBar"></activity>
</application>
I know it is really a small issue but I am unable to figure it out...
Sources I used:
https://developer.android.com/guide/topics/ui/look-and-feel/themes.html
Android theme not being set
Apply a theme to an activity in Android?
EDIT
Current State:
enter image description here
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
Is working but disables the ActionBar for every Activity!
Goal: activity_main2 should not have an ActionBar.
SOLVED It is just a bug from Android Studio. In the Preview it won't disable the AppBar but as soon as you play the App on your phones it works!
To Hide the Action Bar add the below code in Values/Styles
<style name="CustomActivityThemeNoTitle" parent="#android:style/Theme.Light">
<item name="android:windowNoTitle">true</item>
</style>
Then in your AndroidManifest.xml file add the below code in the required activity:
<activity android:name=".Main2Activity"
android:theme="#style/CustomActivityThemeNoTitle"></activity>
Alternatively, you can call this.requestWindowFeature(Window.FEATURE_NO_TITLE); in the onCreate method for your activity. For example:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_signup);
...
}
Try this
<style name="generalnotitle" parent="general">
<item name="android:windowNoTitle">true</item>
</style>
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:logo="#drawable/logo"
android:theme="#style/AppTheme" >
This is my androidmanifest.xml
and in mainactivity.java i use this lines to show logo in action bar.
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.drawable.logo);
after using this two lines in .java file my logo is showing in the display but the app label is gone....
is their any method by which logo & app label both will shown in actionbar after compiling apk.
You not need the two lines in mainactivity.java, you have to select a Theme with the ActionBar:
From res>layout>activity_main.xml(or whatever is the name of the layout of your activity): in the "Design" tab change the theme in "Holo.Light.DarkActionBar" for example.
Or from the AndroidManifest.xml in your app add (or change):
android:theme="#style/AppTheme"
where "AppTheme" is defined in res>values>styles.xml as:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"></style>
Of course in your manifest you have to define the name and logo in the <application> level:
<application
android:logo="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme"
...
Add this into your Activity in manifest.
<activity
android:name=".MainActivity"
android:label="#string/app_name"
</activity>
copy your image file and paste it to the res->minmap folder and then goto your AndroidManifest file and locate the below option
android:icon="#mipmap/image_file_name"
give your icon image file name name here (image_file_name) then run your app.
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 simply trying to change the background color for an activity, however nothing has changed.
Here is the relevant XML:
styles.xml
<resources>
<style name="STBTheme" parent="android:Theme.Light" >
<item name="android:windowBackground">#color/blue</item>
</style>
</resources>
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pedro.stb"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/STBTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/STBTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Furthermore, I'm using Eclipse, and by changing the theme in the activity's xml, it does not change in the graphical layout.
Any help?
Edit
Got it to work. Have to clean the project before reloading the layout. Very annoying...
i had check your code its ok .
try <item name="android:Background">#ccff33</item>
instead of your <item name="android:windowBackground">#color/blue</item>.
and you have write android:theme="#style/STBTheme" > in application as well as activity also.
Just write in application tag .
Hope you will get your output now.
Open the preview of your activity and Click on the circled button as shown
Type the name of your custom theme and Click 'OK' as shown
In Manifest file add the attribute android:theme=".YourTheme" to the required Activity
You will have the theme of the current activity changed.
I dont know why Android Studio acts like it's drunk sometimes. I have two projects with same target,minimum SDK active. One of them had the splash screen theme implemented correctly, the other just wont show until I found this workaround.
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"