Register activity (activities) in Androidmanifest (manifest file) and configure main activity, change app icon, app name, modify hidden title bar

Source: Internet
Author: User

Open app/src/main/androidmanifest.

1<?xml version= "1.0" encoding= "Utf-8"?>2<manifest xmlns:android= "Http://schemas.android.com/apk/res/android"3      Package= "Com.example.administrator.myapplication" >4 5<Application6Android:allowbackup= "true"7android:icon= "@mipmap/ic_launcher"8Android:label= "@string/app_name"9android:roundicon= "@mipmap/ic_launcher_round"TenAndroid:supportsrtl= "true" OneAndroid:theme= "@style/apptheme" ><activity android:name= ". Mainactivity "><intent-filter>14 <action android:name=" Android.intent.actio N.main "/>15 <category android:name=" Android.intent.category.LAUNCHER "/>16 </inte nt-filter></activity> -</application>19 </manifest>

1. Register the current activity. by registering the current activity with the <activity android:name> tag, Android studio automatically registers and Eclipse requires manual registration. . Mainactivity one. Indicates the package name, which is already registered in the package above, so write. Indicates that mainactivity represents the current activity.

2. Configure the main activity. Which activity needs to be started first in which activity is added. The main activity that starts first when the app starts running by <intent-filter> configuration. You can use the following two sentences to declare it.

<action android:name= "Android.intent.action.MAIN"/> <category android:name= " Android.intent.category.LAUNCHER "/>

3. Change the app icon. android:icon= "@mipmap/ic_launcher" represents the app icon , there are 2 ways to change the icon:

A. Click on the app-new-image asset,path path in the project to fill in the location of the icon, shape select None, click Next, select the icon size, then click Finish.

B.res\drawable Place Icon.png, modify androidmanifest.xml:android:icon= "@drawable/icon"

4. Change the contents of the activity title bar. android:label= "@string/app_name", click app-src-res-values-string (or double-click @string/app_name) to enter , in <string Name= "App_name" > tag to modify the contents of the app title bar.

5. Hide the contents of the Activtiy title bar. There are 4 methods.

A. The theme attribute in the manifest file is changed to:android:theme= "@style/theme.appcompat.noactionbar" >

B. Double-click the Android:theme property value to change the Parent property value in the style in the jump to Styles.xml to parent= "Theme.AppCompat.DayNight.NoActionBar".

Remove the title bar code under the C.V7 package and replace the requestwindowfeature (window.feature_no_title); Code:

1 Getsupportactionbar (). Hide ();    2 GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_ fullscreen);

D.mainactivity inherited appcompatactivity changed to activity, but not recommended, appcompatactivity belongs to V7 package, activity belongs to V4 package (official discard).




















Register activity (activities) in Androidmanifest (manifest file) and configure main activity, change app icon, app name, modify hidden title bar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.