할 수있는 작업은 스플래시 화면을 나타내는 활동을 만드는 것입니다. 예 : SplashActivity
. 그런 다음 SplashActivity가 만들어지면 3 초 동안 타이머를 시작합니다 (예 : System.Timers.Timer
). 3 초가 지나면 앱의 주요 활동을 시작하기 만하면됩니다.
사용자가 스플래시 활동으로 되돌아 가지 못하도록하려면 NoHistory = true
속성을 ActivityAttribute (활동 클래스 decleration 바로 위에)에 추가하기 만하면됩니다.
참조 예 :
[Activity(MainLauncher = true, NoHistory = true, Label = "My splash app", Icon = "@drawable/icon")]
public class SplashActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Splash);
Timer timer = new Timer();
timer.Interval = 3000; // 3 sec.
timer.AutoReset = false; // Do not reset the timer after it's elapsed
timer.Elapsed += (object sender, ElapsedEventArgs e) =>
{
StartActivity(typeof(MainActivity));
};
timer.Start();
}
};
[Activity (Label = "Main activity")]
public class MainActivity : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
}
}