ADT blank activity created with fragment activity..

后端 未结 15 2018
鱼传尺愫
鱼传尺愫 2020-11-28 05:55

i am really confused right now because whenever i create a new android app with blank activity it always comes out with fragment_main.xml.. i just wanted to create a blank a

15条回答
  •  忘掉有多难
    2020-11-28 06:01

    While creating a new Application, just copy the Layout Name to the Fragment Layout Name (e.g. activity_main)

    Voila!!! You get an activity without the fragment part.

    Remove this portion of the code from activity:

    if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new PlaceholderFragment())
                    .commit();
    

    Clean the project.

提交回复
热议问题