I am finding that in my Android application, the name of the application is displaying on the top of every screen, consuming a line of valuable screen real estate.
I am using LinearLayouts
How can I get this not to display?
You can set it in the Activity/Application tags in the manifest XML:
android:theme="#android:style/Theme.NoTitleBar"
See more here (Styles and Themes).
Or write in onCreate yours Activity before setContentView():
requestWindowFeature(Window.FEATURE_NO_TITLE);
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen">
<activity
android:name=".A"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
you can add this line android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen" to the manifest and make your application fullscreen and without title bar
and if you want to remove only the title bar and don't want to make the application full screen then you can use Theme.NoTitleBar
Change your activities' theme like that
<activity android:name=".Activity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
android:theme="#style/AppTheme"
Above change in Manifest file didn't work for me.
requestWindowFeature(Window.FEATURE_NO_TITLE)
For this to work in your project you have to make one more change. Make your acivity extends Activity instead of AppCompactActivity which comes by default.
Thank You.
Related
I wanted to show first screen (user's registration) without label and settings menu.
would someone please suggest me how?
Following is the code from manifest.xml
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
The settings icon is the menu option in Android. To remove that just remove the onCreateOptionsMenu() method. But since you also want to remove the title, all in all what you are asking is to remove the action bar itself. That means you want a full screen activity and for that you can simply set a style in the android manifest.
<activity android:name=".LoginActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"/>
I have a little problem, my appliction always display my icon in the menu, home screen stc. My app is a wallpaper app, but in the wallpaper setting list always display a gray images without my icon. Where I can configure that?
In AndroidManifest.xml find application tag and add android:icon="#drawable/icon" replacing icon with id of your resource.
Something like this:
<activity
android:name="com.cotv.MainActivity"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/QTheme.PageIndicatorDefaults" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have the main Activity which has 4 images on the canvas with the screen Orientation as "portrait". When I traverse to the child Activity which has the screen Orientation as "landscape".
Issue : When I come back from the child Activity to the main Activity the 4 images are relocated to different position. I need to resolve this so that the Activity is fine even for the change in screen orientation.
Thanks in Advance.
Layout
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black">
<activity
android:name=".DragDrop"
android:label="#string/title_activity_main"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize|keyboardHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".QuizHard"
android:label="#string/title_activity_main"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize|keyboardHidden" >
<intent-filter>
<action android:name="android.intent.action.QUIZHARD" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
you can set the orientation to portrait of main activity and landscape of child activity in android manifest file.
<activity android:name="Main"
android:screenOrientation="portrait"/>
similarly set orientation to landscape for child activity.
You can add statements to your AndroidManifest.xml file to tell it to handle certain screen changes, such as orientation changes. Normally, when the orientation changes, a new layout is loaded and the screen is recreated, by adding this statement to the manifest file, it won't recreate the view. Change the activity declaration of your activities and add this statement.
<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The android:configChanges="orientation" will prevent Android from recreating the activity, thus preventing it from reloading the view and changing the image positions. You can also add android:screenOrientation="portrait" right after the configChanges statement if you want Android to lock the orientation to portrait, or landscape, if you want.Hope this helps! Would love to hear back from you with the results.
You can add orientation to activity in manifest like this
<activity android:name="Main" android:screenOrientation="portrait"/>
or you can set layout orientation in java file like this
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
I've created an android app, and everything works fine, but when you first hit the icon to launch the app it flashes white with the title bar for a second or two before loading the full interface.
I have a previous app the just flashes black for a second or two before launching, without the title bar but I can't seem to find what is different in the setup/code that makes it do that.
After the app loads I'm removing the title bar with the following line in onCreate
requestWindowFeature(Window.FEATURE_NO_TITLE);
Try this.
In your Manifest activity include android:theme="#android:style/Theme.Light.NoTitleBar"
<activity
android:name=".MainScreen"
android:theme="#android:style/Theme.Light.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Add the below line in your Manifest file for the splashaActivity,
<activity android:name="splashActivity" android:theme="#android:style/Theme.NoTitleBar.Fullscreen" />
Hope this will solve your problem.
I've got a simple application with one single activity. Actually, the launcher icon is the same as the activity's one (the one in the top-left corner). I would like to put another icon in my activity without changing the launchers'one.
Here is my manifest :
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.natinusala.pebkac.MainActivity"
android:label="#string/app_name">
<intent-filter android:logo="#drawable/pebkac">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Actually, I can edit the launcher and activity icon by editing the android:icon="#drawable/ic_launcher" line. I can do it also in adding an android:icon into the <activity> but it modify too the launcher's icon.
How can I do to edit my activity's icon without touching the launcher's one ?
Thanks !
In your manifest, add android:logo="#drawable/ic_yourIcon" to either your Activity or Application tag.