android layout - How to add StackLayout to an activity -


i new xamarin , mobile developing, , having trouble loading stacklayout activity. have layout in class:

public class teststacklayout : contentpage {     public teststacklayout ()     {         stacklayout stacklayout = new stacklayout         {             spacing = 0,             verticaloptions = layoutoptions.fillandexpand,             children =              {                 new label                 {                     text = "stacklayout"                 }             }         };     } } 

and activity, called in mainactivity button:

[activity (label = "testactivity")]  public class testactivity : activity {     protected override void oncreate (bundle bundle)     {         base.oncreate (bundle);     } } 

my question is: how can add teststacklayout testactivity?

your teststacklayout defined contentpage , not layout itself. presents page on app (on every platform).

and dont need add activity every page when working xamarin.forms (thats key). need mainactivity loads xamarin.forms , application. rest done xamarin.forms.

just @ this sample xamarin. can dive code directly understand whats happen.

to start xamarin.forms read this introduction guide.


Comments