Search in sources :

Example 1 with SlidingTabLayout

use of com.flyco.tablayout.SlidingTabLayout in project Android-skin-support by ximsfei.

the class SlidingTabActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sliding_tab);
    for (String title : mTitles) {
        mFragments.add(SimpleCardFragment.getInstance(title));
    }
    View decorView = getWindow().getDecorView();
    ViewPager vp = ViewFindUtils.find(decorView, R.id.vp);
    mAdapter = new MyPagerAdapter(getSupportFragmentManager());
    vp.setAdapter(mAdapter);
    /** 默认 */
    SlidingTabLayout tabLayout_1 = ViewFindUtils.find(decorView, R.id.tl_1);
    /**自定义部分属性*/
    SlidingTabLayout tabLayout_2 = ViewFindUtils.find(decorView, R.id.tl_2);
    /** 字体加粗,大写 */
    SlidingTabLayout tabLayout_3 = ViewFindUtils.find(decorView, R.id.tl_3);
    /** tab固定宽度 */
    SlidingTabLayout tabLayout_4 = ViewFindUtils.find(decorView, R.id.tl_4);
    /** indicator固定宽度 */
    SlidingTabLayout tabLayout_5 = ViewFindUtils.find(decorView, R.id.tl_5);
    /** indicator圆 */
    SlidingTabLayout tabLayout_6 = ViewFindUtils.find(decorView, R.id.tl_6);
    /** indicator矩形圆角 */
    final SlidingTabLayout tabLayout_7 = ViewFindUtils.find(decorView, R.id.tl_7);
    /** indicator三角形 */
    SlidingTabLayout tabLayout_8 = ViewFindUtils.find(decorView, R.id.tl_8);
    /** indicator圆角色块 */
    SlidingTabLayout tabLayout_9 = ViewFindUtils.find(decorView, R.id.tl_9);
    /** indicator圆角色块 */
    SlidingTabLayout tabLayout_10 = ViewFindUtils.find(decorView, R.id.tl_10);
    tabLayout_1.setViewPager(vp);
    tabLayout_2.setViewPager(vp);
    tabLayout_2.setOnTabSelectListener(this);
    tabLayout_3.setViewPager(vp);
    tabLayout_4.setViewPager(vp);
    tabLayout_5.setViewPager(vp);
    tabLayout_6.setViewPager(vp);
    tabLayout_7.setViewPager(vp, mTitles);
    tabLayout_8.setViewPager(vp, mTitles, this, mFragments);
    tabLayout_9.setViewPager(vp);
    tabLayout_10.setViewPager(vp);
    vp.setCurrentItem(4);
    tabLayout_1.showDot(4);
    MsgView rtv_1_4 = tabLayout_1.getMsgView(4);
    if (rtv_1_4 != null) {
        if (rtv_1_4 instanceof SkinMsgView) {
            ((SkinMsgView) rtv_1_4).setBackgroundColorResource(R.color.msg_background_color);
            ((SkinMsgView) rtv_1_4).setStrokeColorResource(R.color.msg_stroke_color);
        } else {
            rtv_1_4.setBackgroundColor(Color.parseColor("#6D8FB0"));
        }
    }
    tabLayout_3.showDot(4);
    tabLayout_2.showDot(4);
    tabLayout_2.showMsg(3, 5);
    tabLayout_2.setMsgMargin(3, 0, 10);
    MsgView rtv_2_3 = tabLayout_2.getMsgView(3);
    if (rtv_2_3 != null) {
        if (rtv_2_3 instanceof SkinMsgView) {
            ((SkinMsgView) rtv_2_3).setBackgroundColorResource(R.color.msg_background_color);
            ((SkinMsgView) rtv_2_3).setStrokeColorResource(R.color.msg_stroke_color);
        } else {
            rtv_2_3.setBackgroundColor(Color.parseColor("#6D8FB0"));
        }
    }
    tabLayout_2.showMsg(5, 5);
    tabLayout_2.setMsgMargin(5, 0, 10);
//        tabLayout_7.setOnTabSelectListener(new OnTabSelectListener() {
//            @Override
//            public void onTabSelect(int position) {
//                Toast.makeText(mContext, "onTabSelect&position--->" + position, Toast.LENGTH_SHORT).show();
//            }
//
//            @Override
//            public void onTabReselect(int position) {
//                mFragments.add(SimpleCardFragment.getInstance("后端"));
//                mAdapter.notifyDataSetChanged();
//                tabLayout_7.addNewTab("后端");
//            }
//        });
}
Also used : SkinMsgView(skin.support.flycotablayout.widget.SkinMsgView) SkinMsgView(skin.support.flycotablayout.widget.SkinMsgView) MsgView(com.flyco.tablayout.widget.MsgView) SlidingTabLayout(com.flyco.tablayout.SlidingTabLayout) SkinMsgView(skin.support.flycotablayout.widget.SkinMsgView) MsgView(com.flyco.tablayout.widget.MsgView) View(android.view.View) ViewPager(android.support.v4.view.ViewPager)

Example 2 with SlidingTabLayout

use of com.flyco.tablayout.SlidingTabLayout in project FlycoTabLayout by H07000223.

the class SlidingTabActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sliding_tab);
    for (String title : mTitles) {
        mFragments.add(SimpleCardFragment.getInstance(title));
    }
    View decorView = getWindow().getDecorView();
    ViewPager vp = ViewFindUtils.find(decorView, R.id.vp);
    mAdapter = new MyPagerAdapter(getSupportFragmentManager());
    vp.setAdapter(mAdapter);
    /**
     * 默认
     */
    SlidingTabLayout tabLayout_1 = ViewFindUtils.find(decorView, R.id.tl_1);
    /**
     *自定义部分属性
     */
    SlidingTabLayout tabLayout_2 = ViewFindUtils.find(decorView, R.id.tl_2);
    /**
     * 字体加粗,大写
     */
    SlidingTabLayout tabLayout_3 = ViewFindUtils.find(decorView, R.id.tl_3);
    /**
     * tab固定宽度
     */
    SlidingTabLayout tabLayout_4 = ViewFindUtils.find(decorView, R.id.tl_4);
    /**
     * indicator固定宽度
     */
    SlidingTabLayout tabLayout_5 = ViewFindUtils.find(decorView, R.id.tl_5);
    /**
     * indicator圆
     */
    SlidingTabLayout tabLayout_6 = ViewFindUtils.find(decorView, R.id.tl_6);
    /**
     * indicator矩形圆角
     */
    final SlidingTabLayout tabLayout_7 = ViewFindUtils.find(decorView, R.id.tl_7);
    /**
     * indicator三角形
     */
    SlidingTabLayout tabLayout_8 = ViewFindUtils.find(decorView, R.id.tl_8);
    /**
     * indicator圆角色块
     */
    SlidingTabLayout tabLayout_9 = ViewFindUtils.find(decorView, R.id.tl_9);
    /**
     * indicator圆角色块
     */
    SlidingTabLayout tabLayout_10 = ViewFindUtils.find(decorView, R.id.tl_10);
    tabLayout_1.setViewPager(vp);
    tabLayout_2.setViewPager(vp);
    tabLayout_2.setOnTabSelectListener(this);
    tabLayout_3.setViewPager(vp);
    tabLayout_4.setViewPager(vp);
    tabLayout_5.setViewPager(vp);
    tabLayout_6.setViewPager(vp);
    tabLayout_7.setViewPager(vp, mTitles);
    tabLayout_8.setViewPager(vp, mTitles, this, mFragments);
    tabLayout_9.setViewPager(vp);
    tabLayout_10.setViewPager(vp);
    vp.setCurrentItem(4);
    tabLayout_1.showDot(4);
    tabLayout_3.showDot(4);
    tabLayout_2.showDot(4);
    tabLayout_2.showMsg(3, 5);
    tabLayout_2.setMsgMargin(3, 0, 10);
    MsgView rtv_2_3 = tabLayout_2.getMsgView(3);
    if (rtv_2_3 != null) {
        rtv_2_3.setBackgroundColor(Color.parseColor("#6D8FB0"));
    }
    tabLayout_2.showMsg(5, 5);
    tabLayout_2.setMsgMargin(5, 0, 10);
// tabLayout_7.setOnTabSelectListener(new OnTabSelectListener() {
// @Override
// public void onTabSelect(int position) {
// Toast.makeText(mContext, "onTabSelect&position--->" + position, Toast.LENGTH_SHORT).show();
// }
// 
// @Override
// public void onTabReselect(int position) {
// mFragments.add(SimpleCardFragment.getInstance("后端"));
// mAdapter.notifyDataSetChanged();
// tabLayout_7.addNewTab("后端");
// }
// });
}
Also used : MsgView(com.flyco.tablayout.widget.MsgView) SlidingTabLayout(com.flyco.tablayout.SlidingTabLayout) MsgView(com.flyco.tablayout.widget.MsgView) View(android.view.View) ViewPager(android.support.v4.view.ViewPager)

Example 3 with SlidingTabLayout

use of com.flyco.tablayout.SlidingTabLayout in project AndriodDesignPattern by Shimingli.

the class BehaviorModelActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.behavioral_model_activity_layout);
    ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
    SlidingTabLayout tab = (SlidingTabLayout) findViewById(R.id.tap);
    mTitles = new String[] { this.getResources().getString(R.string.all_order_tab16), this.getResources().getString(R.string.all_order_tab17), this.getResources().getString(R.string.all_order_tab18), this.getResources().getString(R.string.all_order_tab19), this.getResources().getString(R.string.all_order_tab20), this.getResources().getString(R.string.all_order_tab21), this.getResources().getString(R.string.all_order_tab22), this.getResources().getString(R.string.all_order_tab23), this.getResources().getString(R.string.all_order_tab24), this.getResources().getString(R.string.all_order_tab25) };
    mFragments.add(new StrategyModelFragment());
    mFragments.add(new TemplateModelFragment());
    mFragments.add(new ObserverModelFragment());
    mFragments.add(new IteratorModelFragment());
    mFragments.add(new ChainOfResponsibilityFragment());
    mFragments.add(new CommandPatternModelFragment());
    mFragments.add(new MementoModelFragment());
    mFragments.add(new StateModelFragment());
    mFragments.add(new VisitorPatternModelFragment());
    mFragments.add(new MediatorPatternModelFragment());
    mAdapter = new MyPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(mAdapter);
    tab.setViewPager(pager);
}
Also used : TemplateModelFragment(com.shiming.andrioddesignpattern.ui.TemplateModelFragment) MementoModelFragment(com.shiming.andrioddesignpattern.ui.MementoModelFragment) SlidingTabLayout(com.flyco.tablayout.SlidingTabLayout) ChainOfResponsibilityFragment(com.shiming.andrioddesignpattern.ui.ChainOfResponsibilityFragment) StrategyModelFragment(com.shiming.andrioddesignpattern.ui.StrategyModelFragment) MediatorPatternModelFragment(com.shiming.andrioddesignpattern.mediator_Pattern.MediatorPatternModelFragment) ViewPager(android.support.v4.view.ViewPager) IteratorModelFragment(com.shiming.andrioddesignpattern.ui.IteratorModelFragment) VisitorPatternModelFragment(com.shiming.andrioddesignpattern.Visitor_pattern.VisitorPatternModelFragment) ObserverModelFragment(com.shiming.andrioddesignpattern.ui.ObserverModelFragment) CommandPatternModelFragment(com.shiming.andrioddesignpattern.ui.CommandPatternModelFragment) StateModelFragment(com.shiming.andrioddesignpattern.ui.StateModelFragment)

Example 4 with SlidingTabLayout

use of com.flyco.tablayout.SlidingTabLayout in project AndriodDesignPattern by Shimingli.

the class CreatorModelActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.creator_model_activity_layout);
    ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
    SlidingTabLayout tab = (SlidingTabLayout) findViewById(R.id.tap);
    mTitles = new String[] { this.getResources().getString(R.string.all_order_tab1), this.getResources().getString(R.string.all_order_tab2), this.getResources().getString(R.string.all_order_tab3), this.getResources().getString(R.string.all_order_tab4) };
    mFragments.add(new FactoryMethodModelFragment());
    mFragments.add(new SingletonModelFragment());
    mFragments.add(new BuilderModelFragment());
    mFragments.add(new ProtoTypeModelFragment());
    mAdapter = new MyPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(mAdapter);
    tab.setViewPager(pager);
}
Also used : FactoryMethodModelFragment(com.shiming.andrioddesignpattern.ui.FactoryMethodModelFragment) ProtoTypeModelFragment(com.shiming.andrioddesignpattern.ui.ProtoTypeModelFragment) SlidingTabLayout(com.flyco.tablayout.SlidingTabLayout) ViewPager(android.support.v4.view.ViewPager) SingletonModelFragment(com.shiming.andrioddesignpattern.ui.SingletonModelFragment) BuilderModelFragment(com.shiming.andrioddesignpattern.ui.BuilderModelFragment)

Example 5 with SlidingTabLayout

use of com.flyco.tablayout.SlidingTabLayout in project AndriodDesignPattern by Shimingli.

the class StructuralModelActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.structural_model_activity_layout);
    ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
    SlidingTabLayout tab = (SlidingTabLayout) findViewById(R.id.tap);
    mTitles = new String[] { this.getResources().getString(R.string.all_order_tab5), this.getResources().getString(R.string.all_order_tab10), this.getResources().getString(R.string.all_order_tab11), this.getResources().getString(R.string.all_order_tab12), this.getResources().getString(R.string.all_order_tab13), this.getResources().getString(R.string.all_order_tab14), this.getResources().getString(R.string.all_order_tab15) };
    mFragments.add(new AdapterModelFragment());
    mFragments.add(new DecoratorModelFragment());
    mFragments.add(new ProxyModelFragment());
    mFragments.add(new FacadeModelFragment());
    mFragments.add(new BridgeModelFragment());
    mFragments.add(new CompositeModelFragment());
    mFragments.add(new FlyWeightModelFragment());
    mAdapter = new MyPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(mAdapter);
    tab.setViewPager(pager);
}
Also used : CompositeModelFragment(com.shiming.andrioddesignpattern.ui.CompositeModelFragment) SlidingTabLayout(com.flyco.tablayout.SlidingTabLayout) FlyWeightModelFragment(com.shiming.andrioddesignpattern.ui.FlyWeightModelFragment) FacadeModelFragment(com.shiming.andrioddesignpattern.ui.FacadeModelFragment) ViewPager(android.support.v4.view.ViewPager) DecoratorModelFragment(com.shiming.andrioddesignpattern.ui.DecoratorModelFragment) BridgeModelFragment(com.shiming.andrioddesignpattern.ui.BridgeModelFragment) AdapterModelFragment(com.shiming.andrioddesignpattern.ui.AdapterModelFragment) ProxyModelFragment(com.shiming.andrioddesignpattern.proxy_model.ProxyModelFragment)

Aggregations

ViewPager (android.support.v4.view.ViewPager)5 SlidingTabLayout (com.flyco.tablayout.SlidingTabLayout)5 View (android.view.View)2 MsgView (com.flyco.tablayout.widget.MsgView)2 VisitorPatternModelFragment (com.shiming.andrioddesignpattern.Visitor_pattern.VisitorPatternModelFragment)1 MediatorPatternModelFragment (com.shiming.andrioddesignpattern.mediator_Pattern.MediatorPatternModelFragment)1 ProxyModelFragment (com.shiming.andrioddesignpattern.proxy_model.ProxyModelFragment)1 AdapterModelFragment (com.shiming.andrioddesignpattern.ui.AdapterModelFragment)1 BridgeModelFragment (com.shiming.andrioddesignpattern.ui.BridgeModelFragment)1 BuilderModelFragment (com.shiming.andrioddesignpattern.ui.BuilderModelFragment)1 ChainOfResponsibilityFragment (com.shiming.andrioddesignpattern.ui.ChainOfResponsibilityFragment)1 CommandPatternModelFragment (com.shiming.andrioddesignpattern.ui.CommandPatternModelFragment)1 CompositeModelFragment (com.shiming.andrioddesignpattern.ui.CompositeModelFragment)1 DecoratorModelFragment (com.shiming.andrioddesignpattern.ui.DecoratorModelFragment)1 FacadeModelFragment (com.shiming.andrioddesignpattern.ui.FacadeModelFragment)1 FactoryMethodModelFragment (com.shiming.andrioddesignpattern.ui.FactoryMethodModelFragment)1 FlyWeightModelFragment (com.shiming.andrioddesignpattern.ui.FlyWeightModelFragment)1 IteratorModelFragment (com.shiming.andrioddesignpattern.ui.IteratorModelFragment)1 MementoModelFragment (com.shiming.andrioddesignpattern.ui.MementoModelFragment)1 ObserverModelFragment (com.shiming.andrioddesignpattern.ui.ObserverModelFragment)1