Is it possible to use 2 Layout in 1 Activity, in Xamarin.Android VS2015?

0
     protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        SetContentView(Resource.Layout.ListadoDeEstilos);
        SetContentView(Resource.Layout.DialogInput);
        Inicializar();
        lstEstilos = FindViewById<ListView>(Resource.Id.lstEstilos);

        LoadEstilo();
        lstEstilos.ItemLongClick += LstEstilos_ItemLongClick;

    }

Try to put the two SetContentView, but I get an error when I try to use some control of the second Layout

    
asked by Oscar Navarro 04.09.2017 в 19:55
source

1 answer

1
  

Is it possible to use 2 Layout in 1 Activity?

It is not possible to load them in an Activity since only a layout can be loaded with SetContentView() .

   protected override void OnCreate(Bundle bundle)
   {
       base.OnCreate(bundle);
       SetContentView(Resource.Layout.activity_main);
   }

If you want to load one or more layouts that define a different interface, this is really the goal of Fragments

  

A Fragment is a part of the user interface or behavior   of an application that can be placed in an Activity.

Review the document Fragment Management

    
answered by 04.09.2018 в 23:25