Android fragments Android:Fragment没有片段ID的视图

Android fragments Android:Fragment没有片段ID的视图,android-fragments,android-actionbar,Android Fragments,Android Actionbar,我正在尝试实现操作栏选项卡,在此期间,我在实现fragment类时遇到了一个错误 public class fragmentImplement extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.fragment

我正在尝试实现操作栏选项卡,在此期间,我在实现fragment类时遇到了一个错误

public class fragmentImplement extends Fragment 
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.fragment_layout);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
    {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_layout, container, false);
    }
}
并且XML文件是

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView android:id="@+id/textView1"
    android:text="Fragment A"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>


</LinearLayout>


请帮助我,因为我感到非常沮丧

下次请提供更多信息(哪些错误、发生在哪里等)

要使用
片段
s,还需要
片段活动
片段
是一个可重用的组件,您可以在
片段活动
中使用它

请将此作为使用
Fragment
s的起点,然后再进一步查看本文


据我所知,Android SDK中还有一个示例,它有一个带有选项卡的
操作栏。

请发布错误的堆栈跟踪。