Search in sources :

Example 1 with NavigationController

use of me.majiajie.pagerbottomtabstrip.NavigationController 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);
}
Also used : NavigationController(me.majiajie.pagerbottomtabstrip.NavigationController) MyViewPagerAdapter(me.majiajie.pagerbottomtabstriptest.other.MyViewPagerAdapter) ViewPager(android.support.v4.view.ViewPager) PageBottomTabLayout(me.majiajie.pagerbottomtabstrip.PageBottomTabLayout)

Example 2 with NavigationController

use of me.majiajie.pagerbottomtabstrip.NavigationController 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);
}
Also used : NavigationController(me.majiajie.pagerbottomtabstrip.NavigationController) MyViewPagerAdapter(me.majiajie.pagerbottomtabstriptest.other.MyViewPagerAdapter) ViewPager(android.support.v4.view.ViewPager) PageBottomTabLayout(me.majiajie.pagerbottomtabstrip.PageBottomTabLayout)

Aggregations

ViewPager (android.support.v4.view.ViewPager)2 NavigationController (me.majiajie.pagerbottomtabstrip.NavigationController)2 PageBottomTabLayout (me.majiajie.pagerbottomtabstrip.PageBottomTabLayout)2 MyViewPagerAdapter (me.majiajie.pagerbottomtabstriptest.other.MyViewPagerAdapter)2