how to change the layout in frame layout on the click event?

前端 未结 2 1438
我寻月下人不归
我寻月下人不归 2021-01-28 08:41

i have an layout consisting of two frame layout, my first Frame layout consist of the buttons,and another Frame layout is blank ,on click event on the button in first frame layo

2条回答
  •  佛祖请我去吃肉
    2021-01-28 09:07

    you have to use fragment for that.

    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager
                            .beginTransaction();
    CalculatorTwo calculator = new CalculatorTwo();
    fragmentTransaction.setCustomAnimations(R.anim.slide_top,
                            R.anim.slide_down);
    fragmentTransaction.add(R.id.content_first, calculator);
    ragmentTransaction.commit();
    

提交回复
热议问题