fragment里的tab

package com.bawei.week3.fragment;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.bawei.week3.R;
import com.bawei.week3.adapter.TabAdapter;
import com.bawei.week3.base.BaseFragment;
import com.bawei.week3.tab.Tab01;
import com.bawei.week3.tab.Tab02;
import com.bawei.week3.tab.Tab03;
import com.bawei.week3.tab.Tab04;
import com.bawei.week3.tab.Tab05;
import com.bawei.week3.tab.Tab06;

import java.util.ArrayList;

/**

  • @Author:南方小酒馆°

  • @E-mail:

  • @Date:2019/3/1 15:43

  • @Description:描述信息
    */
    public class Frag01 extends BaseFragment {

    private TabLayout tab;
    private ViewPager pager;

    @Override
    protected int bindLayout() {
    return R.layout.frag01;
    }

    @Override
    protected void initView() {
    tab = bindView(R.id.tab);
    pager = bindView(R.id.pager);
    }

    @Override
    protected void initData() {

     String str[] = {"我们","都在","爱情","里少","一点","天份"};
     ArrayList<Fragment> list = new ArrayList<>();
     list.add(new Tab01());
     list.add(new Tab02());
     list.add(new Tab03());
     list.add(new Tab04());
     list.add(new Tab05());
     list.add(new Tab06());
     TabAdapter adapter = new TabAdapter(getActivity().getSupportFragmentManager(),str,list);
     pager.setAdapter(adapter);
    
     tab.setupWithViewPager(pager);
    

    }

    @Override
    protected void bindEvent() {

    }
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值