use of me.majiajie.pagerbottomtabstrip.PageBottomTabLayout in project PagerBottomTabStrip by tyzlmjj.
the class HideActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hide);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
PageBottomTabLayout pageBottomTabLayout = (PageBottomTabLayout) findViewById(tab);
mNavigationController = pageBottomTabLayout.material().addItem(R.drawable.ic_restore_teal_24dp, "Recents").addItem(R.drawable.ic_favorite_teal_24dp, "Favorites").addItem(R.drawable.ic_nearby_teal_24dp, "Nearby").build();
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(new TestViewPagerAdapter(getSupportFragmentManager()));
mNavigationController.setupWithViewPager(viewPager);
}
use of me.majiajie.pagerbottomtabstrip.PageBottomTabLayout in project PagerBottomTabStrip by tyzlmjj.
the class Custom2Activity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.show);
PageBottomTabLayout tab = (PageBottomTabLayout) findViewById(R.id.tab);
NavigationController navigationController = tab.custom().addItem(newItem(R.drawable.ic_restore_gray_24dp, R.drawable.ic_restore_teal_24dp)).addItem(newItem(R.drawable.ic_favorite_gray_24dp, R.drawable.ic_favorite_teal_24dp)).addItem(newItem(R.drawable.ic_nearby_gray_24dp, R.drawable.ic_nearby_teal_24dp)).build();
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(new MyViewPagerAdapter(getSupportFragmentManager(), navigationController.getItemCount()));
//自动适配ViewPager页面切换
navigationController.setupWithViewPager(viewPager);
}
use of me.majiajie.pagerbottomtabstrip.PageBottomTabLayout in project PagerBottomTabStrip by tyzlmjj.
the class BehaviorActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_behavior);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
PageBottomTabLayout pageBottomTabLayout = (PageBottomTabLayout) findViewById(tab);
mNavigationController = pageBottomTabLayout.material().addItem(R.drawable.ic_restore_teal_24dp, "Recents").addItem(R.drawable.ic_favorite_teal_24dp, "Favorites").addItem(R.drawable.ic_nearby_teal_24dp, "Nearby").build();
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(new TestViewPagerAdapter(getSupportFragmentManager()));
mNavigationController.setupWithViewPager(viewPager);
}
use of me.majiajie.pagerbottomtabstrip.PageBottomTabLayout in project PagerBottomTabStrip by tyzlmjj.
the class CustomActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.show);
PageBottomTabLayout tab = (PageBottomTabLayout) findViewById(R.id.tab);
NavigationController navigationController = tab.custom().addItem(newItem(R.drawable.ic_restore_gray_24dp, R.drawable.ic_restore_teal_24dp, "Recents")).addItem(newItem(R.drawable.ic_favorite_gray_24dp, R.drawable.ic_favorite_teal_24dp, "Favorites")).addItem(newItem(R.drawable.ic_nearby_gray_24dp, R.drawable.ic_nearby_teal_24dp, "Nearby")).build();
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(new MyViewPagerAdapter(getSupportFragmentManager(), navigationController.getItemCount()));
//自动适配ViewPager页面切换
navigationController.setupWithViewPager(viewPager);
//设置消息数
navigationController.setMessageNumber(1, 8);
//设置显示小圆点
navigationController.setHasMessage(0, true);
}
use of me.majiajie.pagerbottomtabstrip.PageBottomTabLayout in project PagerBottomTabStrip by tyzlmjj.
the class MaterialDesignActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.show);
PageBottomTabLayout pageBottomTabLayout = (PageBottomTabLayout) findViewById(tab);
mNavigationController = pageBottomTabLayout.material().addItem(R.drawable.ic_ondemand_video_black_24dp, "Movies & TV", testColors[0]).addItem(R.drawable.ic_audiotrack_black_24dp, "Music", testColors[1]).addItem(R.drawable.ic_book_black_24dp, "Books", testColors[2]).addItem(R.drawable.ic_news_black_24dp, "Newsstand", testColors[3]).setDefaultColor(//未选中状态的颜色
0x89FFFFFF).setMode(//这里可以设置样式模式,总共可以组合出4种效果
MaterialMode.CHANGE_BACKGROUND_COLOR | MaterialMode.HIDE_TEXT).build();
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(new MyViewPagerAdapter(getSupportFragmentManager(), mNavigationController.getItemCount()));
//自动适配ViewPager页面切换
mNavigationController.setupWithViewPager(viewPager);
//也可以设置Item选中事件的监听
mNavigationController.addTabItemSelectedListener(new OnTabItemSelectedListener() {
@Override
public void onSelected(int index, int old) {
Log.i("asd", "selected: " + index + " old: " + old);
}
@Override
public void onRepeat(int index) {
Log.i("asd", "onRepeat selected: " + index);
}
});
//设置消息圆点
// mNavigationController.setMessageNumber(1,12);
// mNavigationController.setHasMessage(1,true);
}
Aggregations