Skip to content

停止维护。自定义实现主流底部 Tab 菜单 View。

Notifications You must be signed in to change notification settings

ifmvo/BottomTabView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 Cannot retrieve latest commit at this time.

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BottomTabView

可以直接复制代码

BottomTabView.java

view_tab_item.xml

使用方法

初始化数据

ArrayList<BottomTabView.TabItemView> tabItemViews = new ArrayList<>();
tabItemViews.add(new BottomTabView.TabItemView(this, "标题1", R.color.colorPrimary, R.color.colorAccent, R.mipmap.ic_launcher, R.mipmap.ic_launcher_round));
tabItemViews.add(new BottomTabView.TabItemView(this, "标题2", R.color.colorPrimary, R.color.colorAccent, R.mipmap.ic_launcher, R.mipmap.ic_launcher_round));
tabItemViews.add(new BottomTabView.TabItemView(this, "标题3", R.color.colorPrimary, R.color.colorAccent, R.mipmap.ic_launcher, R.mipmap.ic_launcher_round));
tabItemViews.add(new BottomTabView.TabItemView(this, "标题4", R.color.colorPrimary, R.color.colorAccent, R.mipmap.ic_launcher, R.mipmap.ic_launcher_round));

设置数据

bottomTabView.setTabItemViews(tabItemViews);

连接 ViewPager

bottomTabView.setUpWithViewPager(viewPager);

设置 Item 选择监听

bottomTabView.setOnTabItemSelectListener(new BottomTabView.OnTabItemSelectListener() {
    @Override
    public void onTabItemSelect(int position) {
        //viewPager.setCurrentItem(position, true);
        //...
    }
});

已经被选中,再次点击的监听

bottomTabView.setOnSecondSelectListener(new BottomTabView.OnSecondSelectListener() {
    @Override
    public void onSecondSelect(int position) {
        //refresh();
    }
});

更多高级使用方法请看MatthewBases

About

停止维护。自定义实现主流底部 Tab 菜单 View。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published