I am new to programming and I'm using Xamarin Studio on my Mac to create Android applications.
Now, I know how to create buttons, TextViews, etc. in code, but I am having a hard time styling them. Most solutions online use XML to create the views and style them, and then add the XML file like this:
[Activity(Label = "ButtonStyle", MainLauncher = true, Icon = "@drawable/icon")] public class Activity1 : Activity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); } } You can only add one 'thing' (I don't have a better word for it) to the SetContentView, so I can't decide to do something like:
SetContentView(Resource.Layout.Main); SetContentView(MyView); Is there a way for me to add views with both XML and C# code?
No comments:
Post a Comment