而不是创建一个新的活动的Andr​​oid,这将创建片段活动这将、创建一个、片段、而不是

由网友(我爱、流氓兔)分享简介:我开发一个Android应用程序,而上周我更新了几包(不记得哪些完全一致)使用SDK管理器。重新启动Eclipse中,每当我创建一个新的活动(与用于仅包含的onCreate和onCreateOptionsMenu方法)后,它创建了一个活动与这两种方法,再加上如下因素code:I am developing an An...

我开发一个Android应用程序,而上周我更新了几包(不记得哪些完全一致)使用SDK管理器。重新启动Eclipse中,每当我创建一个新的活动(与用于仅包含的onCreate和onCreateOptionsMenu方法)后,它创建了一个活动与这两种方法,再加上如下因素code:

I am developing an Android app, and last week I updates a few packages (dont remember which ones exactly) using SDK Manager. After restarting Eclipse, whenever I create a new Activity (with used to contain only onCreate and onCreateOptionsMenu methods), it creates an Activity with those two methods, plus the folowing code :

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

/**
 * 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_lmain,
                container, false);
        return rootView;
    }
}

我是新与Android所以林不知道这是为什么hapening以及如何撤销这些变化,以便能够像以前一样创建一个正常的活动。

I am new with Android so Im not sure why is that hapening and how to "undo" those changes in order to be able to create a "normal" Activity as before.

鸭preciate任何帮助,谢谢。

Appreciate any help, thanks.

推荐答案

我觉得你使用的是Android Studio和,是的,Android的工作室并创造一个片段,当你创建你的应用程序一个额外的方法。

I think you are using Android Studio and and yes, Android Studio does create one fragment and an extra method when you create your application..

这不是一个问题,..你可以直接删除那个fragment.xml之和额外的code这是与一些条件和片段整个另一种方法。

It's not an issue,.. you can just delete that fragment.xml and that extra code that's with some condition and the whole additional method for the fragment.

然后,它会被罚款。我不知道到底为什么它发生在Android的工作室。

Then it will be fine.. I don't know why exactly it happens in Android Studio.

阅读全文

相关推荐

最新文章