iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello Crosslight Support,
what is the best/recommended way to change layouts programmatically (e.g. adding buttons or textviews)?
I tried this on Android, but I got stuck.
I wasn't able to get the main view of the current activity to add additional "sub"views.
I have the following code as constructor of my activity:
public SimpleActivity(): base(Resource.Layout.MainLayout){}
To get a reference to the main view (MainLayout) of the "SimpleActivity" I tried:
LinearLayout mainView = (LinearLayout)this.FindViewById(this.ContentLayoutId);
within OnViewCreated, OnViewInitialized, InitializeView but the mainView variable is always "null".
Thanks for your support.
Thomas
I managed to add TextView into LinearLayout by overriding OnCreate method. The snippet code below shows how.
public class SimpleActivity : Activity<SimpleViewModel> { #region Constructors public SimpleActivity() : base(Resource.Layout.MainLayout) { } protected override void OnCreate(global::Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); LinearLayout mainView = this.FindViewById<LinearLayout>(Resource.Id.Container); TextView txtView = new TextView(this); txtView.SetTextColor(global::Android.Graphics.Color.ParseColor("#FFFFFF")); txtView.SetTextAppearance(this, global::Android.Resource.Style.TextAppearanceMedium); txtView.Text = "test"; mainView.AddView(txtView); } #endregion }
Hope this helps.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname