首页 > 代码库 > android第四周作业笔记

android第四周作业笔记

第四周作业要求如下

 

 

.....看了一下作业要求后,然后做了几周后.....老师....你这是玩我是吧?!你绝壁在玩我?!

算了,多说无益,来看看我们江大婶的做法吧

首先是MainActivity.java

 

package cn.edu.shu.cs.android.experiment04;

import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class MainActivity extends ActionBarActivity implements
        NavigationDrawerFragment.NavigationDrawerCallbacks,
        ActionBar.TabListener {

    //调试用TAG
    private static final String TAG = "11121719";

    private NavigationDrawerFragment mNavigationDrawerFragment;
    private CharSequence mTitle;

    //用于判断当前处于哪个大类
    private int title_section;

    //批量生成各大类下各Tab的Fragment
    private Fragment mFragment_1_1 = new Fragment_1_1();
    private Fragment mFragment_1_2 = new Fragment_1_2();
    private Fragment mFragment_1_3 = new Fragment_1_3();
    private Fragment mFragment_2_1 = new Fragment_2_1();
    private Fragment mFragment_2_2 = new Fragment_2_2();
    private Fragment mFragment_2_3 = new Fragment_2_3();
    private Fragment mFragment_3_1 = new Fragment_3_1();
    private Fragment mFragment_3_2 = new Fragment_3_2();
    private Fragment mFragment_3_3 = new Fragment_3_3();
    private Fragment mFragment_4_1 = new Fragment_4_1();
    private Fragment mFragment_4_2 = new Fragment_4_2();
    private Fragment mFragment_4_3 = new Fragment_4_3();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    }

    @Override
    public void onNavigationDrawerItemSelected(int position) {
        
    }

    public void onSectionAttached(int number) {
        
    }

    public void restoreActionBar() {
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        return super.onOptionsItemSelected(item);
    }

    public static class PlaceholderFragment extends Fragment {
        private static final String ARG_SECTION_NUMBER = "section_number";

        public static PlaceholderFragment newInstance(int sectionNumber) {
        }

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
        }

        @Override
        public void onAttach(Activity activity) {
        }
    }

    @Override
    public void onTabReselected(Tab tab, FragmentTransaction ft) {

    }

    /**
     * 选中Tab时的事件监听,判断需要用哪个Fragment来覆盖
     */
    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        
    }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft) {

    }

}