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


    当做出一个游戏后,编译成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 修改程序名、图标和屏幕方向

  • 相关阅读:
    【洛谷】P1303 A*B Problem(高精度乘法模板)
    快速幂
    【洛谷】P1601 A+B Problem 高精(高精度加法模板)
    进制转换
    【洛谷】P1551 亲戚(并查集模板)
    求最大公约数的两种方法
    快速排序
    异或交换两个数
    数字字符串互相转换的三种方法
    Hello world(我来啦)
  • 原文地址:https://www.cnblogs.com/Anzhongliu/p/6091909.html
Copyright © 2020-2023  润新知