2014-11-01 28 views
0

我在科科斯夏普制作游戏。启动时会出现黑屏。我想要做一些闪屏。我试试there。所以,我的启动画面活动类代码:科科斯夏普应用程序的启动画面

[Activity(Theme = "@style/Theme.Splash", MainLauncher = true, NoHistory = true)]    
public class SplashActivity : Activity 
{ 
    protected override void OnCreate(Bundle bundle) 
    { 
     base.OnCreate(bundle); 

     StartActivity(typeof(MainActivity)); 
    } 
} 

主要活动:

[Activity (Label = "MainActivity")] 
public class MainActivity : AndroidGameActivity 
{ 
    protected override void OnCreate (Bundle bundle) 
    { 
     base.OnCreate (bundle); 

     var application = new CCApplication(); 
     application.ApplicationDelegate = new MyApp.AppDelegate(); 
     SetContentView(application.AndroidContentView); 
     application.StartGame(); 
    } 
} 

我的主题风格:

<?xml version="1.0" encoding="UTF-8" ?> 
<resources> 
    <style name="Theme.Splash" parent="@android:style/Theme.Holo.NoActionBar.Fullscreen"> 
    <item name="android:windowBackground">@drawable/splash</item> 
    <item name="android:windowNoTitle">true</item> 
    </style> 
</resources> 

但是,当我启动应用程序,它只是说,“不幸的是,应用已停止。“所以我在问我的问题是什么。谢谢!

回答

0

最简单的方法是像往常一样将MainActivity设置为启动活动,然后将MainActivity的主题改为“@ style/Theme.Splash”。