GridFragment.java 1.3 KB
package com.cnlive.goldenline.ui.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cnlive.goldenline.R;
import com.cnlive.goldenline.util.LogUtils;

/**
 * Description: 滑动的viewpager
 * Created on 2017/3/6
 * Author : 郭
 */
public class GridFragment extends android.support.v4.app.Fragment {

    private int key = 0;

    public GridFragment() {
        super();
    }

    public static GridFragment newInstance(int key) {

        Bundle args = new Bundle();
        args.putInt("key", key);
        GridFragment fragment = new GridFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Bundle bundle = getArguments();
        if (bundle != null)
        {
            key = bundle.getInt("key");
        }



        if (key == 1) {
            LogUtils.LOGE("111111111111111111");
            return inflater.inflate(R.layout.layout_vip_vp, null);
        } else {
            LogUtils.LOGE("222222222222222");
            return inflater.inflate(R.layout.layout_vip_vp2, null);
        }
    }
}