与片段活动ADT空白活动创造.. [英] ADT blank activity created with fragment activity..

查看:142
本文介绍了与片段活动ADT空白活动创造..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是真的很困惑,因为现在每当我创建一个空白的活动一个新的Andr​​oid应用程序,它永远是与fragment_main.xml ..我只是想创建一个空白的活动没有片段之一... ...

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 activity without the fragment one...

在第一个图像的空白活动自带的片段布局。

in the first image the blank activity comes with the fragment layout..

第二个图像显示了创建fragment_main

the second image shows the created fragment_main

现在我真的很迷茫......这只是发生在更新ADT到最新版本后, 我已经提到了这个主题:=> Adt的不创建默认的Hello World,但命令行确实

now i am really confused... this only happened after updating ADT to the latest version i have referred to this thread: =">Adt doesn't create default hello world but command line does

我只是想,没有碎片观点,与空白活动Android应用程序...

i just wanted to make an android app with blank activity with no fragment view...

推荐答案

对于那些谁愿意就如何从项目中删除片段说明:

For those who would like instructions on how to remove Fragments from the project:

1)复制的RES /布局/ fragment_main.xml所有内容。开activity_main.xml,删除的FrameLayout,并在复制的内容粘贴

1) Copy all the contents of res/layout/fragment_main.xml. Open activity_main.xml, delete the FrameLayout, and paste in the copied contents.

2)删除fragment_main.xml

2) Delete fragment_main.xml

3)在MainActivity.java,删除整个PlaceHolderFragment类:

3) In MainActivity.java, delete the whole PlaceHolderFragment class:

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                    Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main,
                    container, false);
        return rootView;
    }
}

4)删除的onCreate()以下行:

4) Delete the following lines from onCreate():

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

在这一点上,你应该是所有设置为运行该项目。

At this point you should be all set to run the project.

这篇关于与片段活动ADT空白活动创造..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆