battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programming a forum for elite programmers with extreme will power to sharpen their skills
HomeGallerySearchRegisterLog in

 xamarin c# changing the app background image

Go down 
Moti Barski
Moti Barski

Posts : 573
Join date : 2011-08-02

xamarin c# changing the app background image Empty
PostSubject: xamarin c# changing the app background image   xamarin c# changing the app background image EmptySat Oct 07, 2017 3:23 pm

in the solution explorer (right side window), rightclick copy mainActivity.cs, right click paste it on
then rename it (new name.cs)
change the declaration to
[Activity(Label = "SecondScreen")]
public class SecondScreen : Activity
you can also change the icon, save all
in the main activity summon the new activity with:
button1.Click += delegate { StartActivity(typeof(SecondScreen)); };

2.2 manipulating the newly added activity UserInterface technique :
in the layout folder add SecondScreen.axml (in my case SecondScreen.axml) by copypasting the main.axml
add SetContentView(Resource.Layout.SecondScreen);
here is how my code looks like now :
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace App15
    [Activity(Label = "SecondScreen")]
    public class SecondScreen : Activity
        int count = 1;

        protected override void OnCreate(Bundle bundle)

            // Set our view from the "main" layout resource

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);

            button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
set the second screen.xaml background image to one you add to the resources drawable
now the SecondScreen.axml is the UI of the SecondScreen.cs you added bwahaha !

MB over and out emp it up
Back to top Go down
xamarin c# changing the app background image
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: