android 工作室不会给我充气 xml

android studio will not inflate my xml

我在 android studio 中遇到问题,当加载模拟器时,它不会将我的 xml 膨胀到我的 java 文件,它还给我一个问题我的方法说支持 v4 是必需的,尽管它已经被导入了。

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;


public class ViewPagerAdapter extends FragmentPagerAdapter {

final int PAGE_COUNT = 2;
// Tab Titles
private String tabtitles[] = new String[] {"Home","Shouters"};
Context context;

public ViewPagerAdapter(FragmentManager fm) {
    super(fm);
}

@Override
public int getCount() {
    return PAGE_COUNT;
}


    public Fragment getItem(int position) {
    switch (position) {

        // Open Fragment home.java
        case 0:
            FragmentHome fragmenthome = new FragmentHome();
            return fragmenthome;

        // Open Fragment shouters.java
        case 1:
            FragmentShouters fragmentshouter = new FragmentShouters();
            return fragmentshouter;


    }
    return null;
}

@Override
public CharSequence getPageTitle(int position) {
    return tabtitles[position];
}
}

v4 问题是我在哪里获取片段主页的项目

public class FragmentHome extends Activity {


public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Get the view from fragment home.xml
    View view = inflater.inflate(R.layout.fragmenthome, container, false);
    return view;

我的 inflation 不会出现这个问题?

FragmentHome 应该扩展 Fragment,而不是 Activity