2015-01-16 2 views
1

를 사용하여 시작 화면이 불행하게도이 링크는 드로어 블을 사용하여 시작 화면을 만드는 방법을 보여줍니다. 하지만 내가해야 할 일은 레이아웃을 사용하여 스플래시 화면을 작성하여 모양을 쉽게 사용자 정의하고 다른 화면 크기와 호환되도록 만드는 것입니다.자 마린 :이 링크 <a href="http://developer.xamarin.com/guides/android/user_interface/creating_a_splash_screen/" rel="nofollow">http://developer.xamarin.com/guides/android/user_interface/creating_a_splash_screen/</a></p> <p>같이 내가 내 안드로이드 응용 프로그램 시작 화면을 만들려고하고 레이아웃

감사합니다.

답변

8

할 수있는 작업은 스플래시 화면을 나타내는 활동을 만드는 것입니다. 예 : 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); 
     } 
    } 
관련 문제