Search in sources :

Example 1 with SegmentTabLayout

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

the class SegmentTabActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_segment_tab);
    for (String title : mTitles_3) {
        mFragments.add(SimpleCardFragment.getInstance("Switch ViewPager " + title));
    }
    for (String title : mTitles_2) {
        mFragments2.add(SimpleCardFragment.getInstance("Switch Fragment " + title));
    }
    mDecorView = getWindow().getDecorView();
    SegmentTabLayout tabLayout_1 = ViewFindUtils.find(mDecorView, R.id.tl_1);
    SegmentTabLayout tabLayout_2 = ViewFindUtils.find(mDecorView, R.id.tl_2);
    mTabLayout_3 = ViewFindUtils.find(mDecorView, R.id.tl_3);
    SegmentTabLayout tabLayout_4 = ViewFindUtils.find(mDecorView, R.id.tl_4);
    SegmentTabLayout tabLayout_5 = ViewFindUtils.find(mDecorView, R.id.tl_5);
    tabLayout_1.setTabData(mTitles);
    tabLayout_2.setTabData(mTitles_2);
    tl_3();
    tabLayout_4.setTabData(mTitles_2, this, R.id.fl_change, mFragments2);
    tabLayout_5.setTabData(mTitles_3);
    //显示未读红点
    tabLayout_1.showDot(2);
    tabLayout_2.showDot(2);
    mTabLayout_3.showDot(1);
    tabLayout_4.showDot(1);
    //设置未读消息红点
    mTabLayout_3.showDot(2);
    MsgView rtv_3_2 = mTabLayout_3.getMsgView(2);
    if (rtv_3_2 != null) {
        rtv_3_2.setBackgroundColor(Color.parseColor("#6D8FB0"));
    }
}
Also used : SegmentTabLayout(com.flyco.tablayout.SegmentTabLayout) MsgView(com.flyco.tablayout.widget.MsgView)

Example 2 with SegmentTabLayout

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

the class SegmentTabActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_segment_tab);
    for (String title : mTitles_3) {
        mFragments.add(SimpleCardFragment.getInstance("Switch ViewPager " + title));
    }
    for (String title : mTitles_2) {
        mFragments2.add(SimpleCardFragment.getInstance("Switch Fragment " + title));
    }
    mDecorView = getWindow().getDecorView();
    SegmentTabLayout tabLayout_1 = ViewFindUtils.find(mDecorView, R.id.t3_1);
    SegmentTabLayout tabLayout_2 = ViewFindUtils.find(mDecorView, R.id.t3_2);
    mTabLayout_3 = ViewFindUtils.find(mDecorView, R.id.t3_3);
    SegmentTabLayout tabLayout_4 = ViewFindUtils.find(mDecorView, R.id.t3_4);
    SegmentTabLayout tabLayout_5 = ViewFindUtils.find(mDecorView, R.id.t3_5);
    tabLayout_1.setTabData(mTitles);
    tabLayout_2.setTabData(mTitles_2);
    tl_3();
    tabLayout_4.setTabData(mTitles_2, this, R.id.fl_change, mFragments2);
    tabLayout_5.setTabData(mTitles_3);
    //显示未读红点
    tabLayout_1.showDot(2);
    MsgView rtv_1_2 = tabLayout_1.getMsgView(2);
    if (rtv_1_2 != null) {
        if (rtv_1_2 instanceof SkinMsgView) {
            ((SkinMsgView) rtv_1_2).setBackgroundColorResource(R.color.msg_background_color);
        }
    }
    tabLayout_2.showDot(2);
    MsgView rtv_2_2 = tabLayout_2.getMsgView(2);
    if (rtv_2_2 != null) {
        if (rtv_2_2 instanceof SkinMsgView) {
            ((SkinMsgView) rtv_2_2).setBackgroundColorResource(R.color.msg_background_color);
        }
    }
    mTabLayout_3.showDot(1);
    tabLayout_4.showDot(1);
    MsgView rtv_4_1 = tabLayout_4.getMsgView(1);
    if (rtv_4_1 != null) {
        if (rtv_4_1 instanceof SkinMsgView) {
            ((SkinMsgView) rtv_4_1).setBackgroundColorResource(R.color.msg_background_color);
        }
    }
    //设置未读消息红点
    mTabLayout_3.showDot(2);
    MsgView rtv_3_2 = mTabLayout_3.getMsgView(2);
    if (rtv_3_2 != null) {
        if (rtv_3_2 instanceof SkinMsgView) {
            ((SkinMsgView) rtv_3_2).setBackgroundColorResource(R.color.msg_background_color);
            ((SkinMsgView) rtv_3_2).setStrokeColorResource(R.color.msg_stroke_color);
        } else {
            rtv_3_2.setBackgroundColor(Color.parseColor("#6D8FB0"));
        }
    }
}
Also used : SegmentTabLayout(com.flyco.tablayout.SegmentTabLayout) SkinMsgView(skin.support.flycotablayout.widget.SkinMsgView) SkinMsgView(skin.support.flycotablayout.widget.SkinMsgView) MsgView(com.flyco.tablayout.widget.MsgView)

Aggregations

SegmentTabLayout (com.flyco.tablayout.SegmentTabLayout)2 MsgView (com.flyco.tablayout.widget.MsgView)2 SkinMsgView (skin.support.flycotablayout.widget.SkinMsgView)1