ADT blank activity created with fragment activity..

后端 未结 15 2017
鱼传尺愫
鱼传尺愫 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:02

    You can use the previous template by editing the template files inside the Android SDK folder. But, make sure you have a backup of the "BlankActivity" folder.

    • Go to /templates/tools/templates/activities/BlankActivity

    • Locate the template.xml file and locate the following piece of code

       
      

    and change the constraints to constraints="empty".

    • Locate recipie.xml.ftl and locate the following piece of code

      and comment the whole line.

    • Locate SampleActivity.java.ftl file inside root/src/app_package and delete these two lines
      <#include "include_options_menu.java.ftl"> <#include "include_fragment.java.ftl">

    • Locate fragment_simple.xml.ftl and activity_fragment_container.xml.ftl file inside root/res/layout. Copy the contents of fragment_simple.xml.ftl file to activity_fragment_container.xml.ftl file.

    Now when you try to create a new activity, you'll get this screen new activity without fragment

    You can leave the Fragment Layout Name field blank.

    This works fine for me in the case of blank activity. I'm not sure if this is the right approach, with discarding fragments and all, but this works for me.

提交回复
热议问题