Change layout programmatically

1 reply. Last post: September 30, 2014 10:15 AM by Yudi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

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

All times are GMT -5. The time now is 10:45 PM.
Previous Next