Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How can i change the MainActivity view in android ?

$
0
0

Hi,
Initially when my app loads i get a blank activity. Is there any way that i can use this as a splash screen by setting some layout. Or at the max can i hide the top navigation bar. I tried many things like changing the activity theme (NoTitleBar) or to set the content view. It throws exception.

[Activity(Label = "Test", NoHistory = false, MainLauncher = true, ConfigurationChanges = (ConfigChanges.ScreenSize | ConfigChanges.Orientation))]
public class MainActivity : AndroidActivity
{
    protected override void OnCreate(Bundle bundle)
    {
        try
        {
            base.OnCreate(bundle);
            //LinearLayout ll = new LinearLayout(this.BaseContext);
            //ll.SetBackgroundColor(Android.Graphics.Color.Black);
            //ImageView img = new ImageView(this);
            //img.SetImageResource(Resource.Drawable.splash_logo);
            //ll.AddView(img);
            //this.SetContentView(ll);

            Xamarin.Forms.Forms.Init(this, bundle);

            SetPage(App.GetMainPage());
        }
        catch (Exception ex)
        {
        }
    }

Viewing all articles
Browse latest Browse all 58056

Trending Articles