two different layouts for one activity

后端 未结 5 1285
春和景丽
春和景丽 2020-12-08 15:57

Is it possible to have two different layouts for different cases in the same activity or do I have to use intent to call another activity with a di

5条回答
  •  既然无缘
    2020-12-08 16:28

    Yes its possible. You can use as many layouts as possible for a single activity but obviously not simultaneously. You can use something like:

    if (Case_A)
      setContentView(R.layout.layout1);
    
    else if (Case_B)
      setContentView(R.layout.layout2);
    

    and so on...

提交回复
热议问题