package com.gsls.b_mvp.view.activity; import android.os.Bundle;import android.widget.TextView; import androidx.fragment.app.Fragment; import com.gsls.b_mvp.R;import com.gsls.b_mvp.base.BaseActivity;import com.gsls.b_mvp.view.fragment.DomeFragment1;import com.gsls.b_mvp.view.fragment.DomeFragment2;import com.gsls.b_mvp.view.fragment.DomeFragment3;import com.gsls.b_mvp.view.fragment.DomeFragment4;import com.gsls.b_mvp.view.util.GT; import java.util.ArrayList;import java.util.List; /** * author:hello * time:2019/7/5 * CSDN: qq_39799899 * explain:只负责加载 View 层 **/public abstract class MainView extends BaseActivity { protected GT.GT_Fragment gt_fragment; private Bundle savedInstanceState; protected TextView tv; @Override protected int initLayout(Bundle savedInstanceState) { this.savedInstanceState = savedInstanceState; return R.layout.activity_main; } @Override protected void initData() { initView();//初始化 View 组件 initFragment();//初始化 Fragment 管理器 } private void initView(){ tv = findViewById(R.id.main_version); } private void initFragment(http://www.amjmh.com/v/) { //添加要管理的 Fragment List<Fragment> list = new ArrayList<>(); list.add(new DomeFragment1()); list.add(new DomeFragment2()); list.add(new DomeFragment3()); list.add(new DomeFragment4()); //实例化 Fragment 管理工具 gt_fragment = new GT.GT_Fragment(savedInstanceState,this,getSupportFragmentManager()); gt_fragment.initFragment(R.id.main_fl,list,0);//初始化 Fragment 管理工具 } }