参考:https://www.jianshu.com/p/21d269c8ef09
创建文件
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--这里为继承 CCC 默认说采用的主题 Theme.NoTitleBar.Fullscreen -->
<style name="SplashStyle"
parent="@android:style/Theme.NoTitleBar.Fullscreen" >
<!--自定义主题背景图片-->
<item name="android:windowBackground">@drawable/splash</item>
<!--令主题无标题-->
<item name="android:windowNoTitle" >true</item >
</style >
</resources>
修改文件
//第一步,修改之前的初始activity为LaunchActivity
<activity
android:name="org.cocos2dx.javascript.LaunchActivity"
...
android:theme="@style/SplashStyle"
...
>
//第二步,添加一个activity标签来注册之前的初始activity
<activity android:name="org.cocos2dx.javascript.AppActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
添加
public class LaunchActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// getWindow().setFlags(
// WindowManager.LayoutParams.FLAG_FULLSCREEN,
// WindowManager.LayoutParams.FLAG_FULLSCREEN);
/*采用handler创建子线程实现页面跳转*/
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent =new Intent(LaunchActivity.this,AppActivity.class);
startActivity(intent);
LaunchActivity.this.finish();
}
},1000);
}
}