安卓新手问题,小白求教大神们

写侧滑界面有两个报错

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;

public class Listleft extends FragmentActivity {

public static final String[] TITLES = { "First", "Second" };                
private LinearLayout mDrawer_layout;
private RelativeLayout mMenu_layout_left;

protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.leftfragmenty);
    mDrawer_layout = (LinearLayout) findViewById(R.id.drawer_layout);
    mMenu_layout_left = (RelativeLayout)findViewById(R.id.menu_left_out);
    ListView menu_listview_l = (ListView) mMenu_layout_left.findViewById(R.id.menu_listView_l);
    menu_listview_l.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1,TITLES));
    menu_listview_l.setOnItemClickListener(new DrawerItemClickListenerLeft());

}
public class DrawerItemClickListenerLeft implements OnItemClickListener{


    public void onItemClick(AdapterView<?> parent, View view, int position, long id){
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        Fragment fragment = null;

        switch (position){
            case 0:
                fragment = new FirstFragment();  
                break;
            case 1:
                fragment = new SecondFragment();
                break;
            default:
                break;
        }
        ft.replace(R.id.fragment_layout,fragment);
        ft.commit();
        mDrawer_layout.closeDrawer(mMenu_layout_left);

    }



}

}

第一个是说类型不兼容,FirstFragment类不能转变成Fragement

这是我的FirstFragment类

public class FirstFragment extends Fragment {

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saveInstance){
    return inflater.inflate(R.layout.fragment_first,null);
}

}

还有一个是 mDrawer_layout.closeDrawer(mMenu_layout_left);
无法resovle这个方法

是不是你的FirstFragment 继承的父类的包导错了?因为你的Listleft 中fragment导的包是V4的。

你的closeDrawer方法应该是DrawerLayout的方法。而你的 mDrawer_layout 明显是LinearLayout