加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Cocos2d-x 3.1 修改程序名、图标和屏幕方向

发布时间:2020-12-14 16:38:24 所属栏目:百科 来源:网络整理
导读:当做出一个游戏后,编译成apk安装在手机上,你会发现程序名和图标都是默认的,而放心默认是横屏,那么在哪里改呢? 打开工程-proj.android,找到AndroidManifest.xml并打开: ?xml version="1.0" encoding="utf-8"?manifest xmlns:android="http://schemas.a

当做出一个游戏后,编译成apk安装在手机上,你会发现程序名和图标都是默认的,而放心默认是横屏,那么在哪里改呢?


打开工程->proj.android,找到AndroidManifest.xml并打开:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.pianotiles.org"
      android:versionCode="1"
      android:versionName="1.0">

    <uses-sdk android:minSdkVersion="9"/>
    <uses-feature android:glEsVersion="0x00020000" />

    <application android:label="@string/app_name" 
                 android:icon="@drawable/icon"> 		
					 
        <!-- Tell Cocos2dxActivity the name of our .so -->
        <meta-data android:name="android.app.lib_name"
	              android:value="cocos2dcpp" />

        <activity android:name="org.cocos2dx.cpp.AppActivity"
                  android:label="@string/app_name"
                  android:screenOrientation="portrait"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:configChanges="orientation">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

    <supports-screens android:anyDensity="true"
                      android:smallScreens="true"
                      android:normalScreens="true"
                      android:largeScreens="true"
                      android:xlargeScreens="true"/>

    <uses-permission android:name="android.permission.INTERNET"/>
</manifest> 

先看application标签:

android:label:应用程序名字,@string/app_name说明在string.xml定义了app_name标签,可以到proj.android/res/values目录下查找string.xml文件并修改。

android:icon:程序图标,打开proj.android/res发现有三个drawable前缀的文件夹,drawable-hdpi、drawable-mdpi、drawable-ldpi,里面存放的图片分别对应高分辨率、中分辨率和低分辨率的图片。

再看activity标签:

android:name:activity的类名,必须指定。

android:label:定义这个之后,就会覆盖application中的android:label。

android:screenOrientation:屏幕放心,默认是横屏landscape,竖屏是portrait。

Cocos2d-x 3.1 修改程序名、图标和屏幕方向

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读