com.flyco.tablayout.widget.MsgView Java Examples
The following examples show how to use
com.flyco.tablayout.widget.MsgView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SlidingTabLayout.java From FlycoTabLayout with MIT License | 6 votes |
/** 设置未读消息偏移,原点为文字的右上角.当控件高度固定,消息提示位置易控制,显示效果佳 */ public void setMsgMargin(int position, float leftPadding, float bottomPadding) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title); mTextPaint.setTextSize(mTextsize); float textWidth = mTextPaint.measureText(tv_tab_title.getText().toString()); float textHeight = mTextPaint.descent() - mTextPaint.ascent(); MarginLayoutParams lp = (MarginLayoutParams) tipView.getLayoutParams(); lp.leftMargin = mTabWidth >= 0 ? (int) (mTabWidth / 2 + textWidth / 2 + dp2px(leftPadding)) : (int) (mTabPadding + textWidth + dp2px(leftPadding)); lp.topMargin = mHeight > 0 ? (int) (mHeight - textHeight) / 2 - dp2px(bottomPadding) : 0; tipView.setLayoutParams(lp); } }
Example #2
Source File: SegmentTabLayout.java From FlycoTabLayout with MIT License | 6 votes |
/** * 显示未读消息 * * @param position 显示tab位置 * @param num num小于等于0显示红点,num大于0显示数字 */ public void showMsg(int position, int num) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { UnreadMsgUtils.show(tipView, num); if (mInitSetMap.get(position) != null && mInitSetMap.get(position)) { return; } setMsgMargin(position, 2, 2); mInitSetMap.put(position, true); } }
Example #3
Source File: SegmentTabLayout.java From FlycoTabLayout with MIT License | 6 votes |
/** * 设置提示红点偏移,注意 * 1.控件为固定高度:参照点为tab内容的右上角 * 2.控件高度不固定(WRAP_CONTENT):参照点为tab内容的右上角,此时高度已是红点的最高显示范围,所以这时bottomPadding其实就是topPadding */ public void setMsgMargin(int position, float leftPadding, float bottomPadding) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title); mTextPaint.setTextSize(mTextsize); float textWidth = mTextPaint.measureText(tv_tab_title.getText().toString()); float textHeight = mTextPaint.descent() - mTextPaint.ascent(); MarginLayoutParams lp = (MarginLayoutParams) tipView.getLayoutParams(); lp.leftMargin = dp2px(leftPadding); lp.topMargin = mHeight > 0 ? (int) (mHeight - textHeight) / 2 - dp2px(bottomPadding) : dp2px(bottomPadding); tipView.setLayoutParams(lp); } }
Example #4
Source File: SlidingTabLayout.java From likequanmintv with Apache License 2.0 | 6 votes |
/** 设置未读消息偏移,原点为文字的右上角.当控件高度固定,消息提示位置易控制,显示效果佳 */ public void setMsgMargin(int position, float leftPadding, float bottomPadding) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title); mTextPaint.setTextSize(mTextsize); float textWidth = mTextPaint.measureText(tv_tab_title.getText().toString()); float textHeight = mTextPaint.descent() - mTextPaint.ascent(); MarginLayoutParams lp = (MarginLayoutParams) tipView.getLayoutParams(); lp.leftMargin = mTabWidth >= 0 ? (int) (mTabWidth / 2 + textWidth / 2 + dp2px(leftPadding)) : (int) (mTabPadding + textWidth + dp2px(leftPadding)); lp.topMargin = mHeight > 0 ? (int) (mHeight - textHeight) / 2 - dp2px(bottomPadding) : 0; tipView.setLayoutParams(lp); } }
Example #5
Source File: SlidingTabLayout.java From likequanmintv with Apache License 2.0 | 6 votes |
/** * 显示未读消息 * * @param position 显示tab位置 * @param num num小于等于0显示红点,num大于0显示数字 */ public void showMsg(int position, int num) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { UnreadMsgUtils.show(tipView, num); if (mInitSetMap.get(position) != null && mInitSetMap.get(position)) { return; } setMsgMargin(position, 4, 2); mInitSetMap.put(position, true); } }
Example #6
Source File: CommonTabLayout.java From FlycoTabLayout with MIT License | 6 votes |
/** * 显示未读消息 * * @param position 显示tab位置 * @param num num小于等于0显示红点,num大于0显示数字 */ public void showMsg(int position, int num) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { UnreadMsgUtils.show(tipView, num); if (mInitSetMap.get(position) != null && mInitSetMap.get(position)) { return; } if (!mIconVisible) { setMsgMargin(position, 2, 2); } else { setMsgMargin(position, 0, mIconGravity == Gravity.LEFT || mIconGravity == Gravity.RIGHT ? 4 : 0); } mInitSetMap.put(position, true); } }
Example #7
Source File: CommonTabLayout.java From likequanmintv with Apache License 2.0 | 6 votes |
/** * 显示未读消息 * * @param position 显示tab位置 * @param num num小于等于0显示红点,num大于0显示数字 */ public void showMsg(int position, int num) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { UnreadMsgUtils.show(tipView, num); if (mInitSetMap.get(position) != null && mInitSetMap.get(position)) { return; } if (!mIconVisible) { setMsgMargin(position, 2, 2); } else { setMsgMargin(position, 0, mIconGravity == Gravity.LEFT || mIconGravity == Gravity.RIGHT ? 4 : 0); } mInitSetMap.put(position, true); } }
Example #8
Source File: SegmentTabLayout.java From likequanmintv with Apache License 2.0 | 6 votes |
/** * 设置提示红点偏移,注意 * 1.控件为固定高度:参照点为tab内容的右上角 * 2.控件高度不固定(WRAP_CONTENT):参照点为tab内容的右上角,此时高度已是红点的最高显示范围,所以这时bottomPadding其实就是topPadding */ public void setMsgMargin(int position, float leftPadding, float bottomPadding) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title); mTextPaint.setTextSize(mTextsize); float textWidth = mTextPaint.measureText(tv_tab_title.getText().toString()); float textHeight = mTextPaint.descent() - mTextPaint.ascent(); MarginLayoutParams lp = (MarginLayoutParams) tipView.getLayoutParams(); lp.leftMargin = dp2px(leftPadding); lp.topMargin = mHeight > 0 ? (int) (mHeight - textHeight) / 2 - dp2px(bottomPadding) : dp2px(bottomPadding); tipView.setLayoutParams(lp); } }
Example #9
Source File: SlidingTabLayout.java From FlycoTabLayout with MIT License | 6 votes |
/** * 显示未读消息 * * @param position 显示tab位置 * @param num num小于等于0显示红点,num大于0显示数字 */ public void showMsg(int position, int num) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { UnreadMsgUtils.show(tipView, num); if (mInitSetMap.get(position) != null && mInitSetMap.get(position)) { return; } setMsgMargin(position, 4, 2); mInitSetMap.put(position, true); } }
Example #10
Source File: SegmentTabLayout.java From likequanmintv with Apache License 2.0 | 6 votes |
/** * 显示未读消息 * * @param position 显示tab位置 * @param num num小于等于0显示红点,num大于0显示数字 */ public void showMsg(int position, int num) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { UnreadMsgUtils.show(tipView, num); if (mInitSetMap.get(position) != null && mInitSetMap.get(position)) { return; } setMsgMargin(position, 2, 2); mInitSetMap.put(position, true); } }
Example #11
Source File: UnreadMsgUtils.java From FlycoTabLayout with MIT License | 5 votes |
public static void setSize(MsgView rtv, int size) { if (rtv == null) { return; } RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) rtv.getLayoutParams(); lp.width = size; lp.height = size; rtv.setLayoutParams(lp); }
Example #12
Source File: UnreadMsgUtils.java From FlycoTabLayout with MIT License | 5 votes |
public static void show(MsgView msgView, int num) { if (msgView == null) { return; } RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) msgView.getLayoutParams(); DisplayMetrics dm = msgView.getResources().getDisplayMetrics(); msgView.setVisibility(View.VISIBLE); if (num <= 0) {//圆点,设置默认宽高 msgView.setStrokeWidth(0); msgView.setText(""); lp.width = (int) (5 * dm.density); lp.height = (int) (5 * dm.density); msgView.setLayoutParams(lp); } else { lp.height = (int) (18 * dm.density); if (num > 0 && num < 10) {//圆 lp.width = (int) (18 * dm.density); msgView.setText(num + ""); } else if (num > 9 && num < 100) {//圆角矩形,圆角是高度的一半,设置默认padding lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT; msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0); msgView.setText(num + ""); } else {//数字超过两位,显示99+ lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT; msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0); msgView.setText("99+"); } msgView.setLayoutParams(lp); } }
Example #13
Source File: CommonTabLayout.java From FlycoTabLayout with MIT License | 5 votes |
/** 当前类只提供了少许设置未读消息属性的方法,可以通过该方法获取MsgView对象从而各种设置 */ public MsgView getMsgView(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); return tipView; }
Example #14
Source File: CommonTabLayout.java From FlycoTabLayout with MIT License | 5 votes |
/** * 设置提示红点偏移,注意 * 1.控件为固定高度:参照点为tab内容的右上角 * 2.控件高度不固定(WRAP_CONTENT):参照点为tab内容的右上角,此时高度已是红点的最高显示范围,所以这时bottomPadding其实就是topPadding */ public void setMsgMargin(int position, float leftPadding, float bottomPadding) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title); mTextPaint.setTextSize(mTextsize); float textWidth = mTextPaint.measureText(tv_tab_title.getText().toString()); float textHeight = mTextPaint.descent() - mTextPaint.ascent(); MarginLayoutParams lp = (MarginLayoutParams) tipView.getLayoutParams(); float iconH = mIconHeight; float margin = 0; if (mIconVisible) { if (iconH <= 0) { iconH = mContext.getResources().getDrawable(mTabEntitys.get(position).getTabSelectedIcon()).getIntrinsicHeight(); } margin = mIconMargin; } if (mIconGravity == Gravity.TOP || mIconGravity == Gravity.BOTTOM) { lp.leftMargin = dp2px(leftPadding); lp.topMargin = mHeight > 0 ? (int) (mHeight - textHeight - iconH - margin) / 2 - dp2px(bottomPadding) : dp2px(bottomPadding); } else { lp.leftMargin = dp2px(leftPadding); lp.topMargin = mHeight > 0 ? (int) (mHeight - Math.max(textHeight, iconH)) / 2 - dp2px(bottomPadding) : dp2px(bottomPadding); } tipView.setLayoutParams(lp); } }
Example #15
Source File: CommonTabLayout.java From FlycoTabLayout with MIT License | 5 votes |
public void hideMsg(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { tipView.setVisibility(View.GONE); } }
Example #16
Source File: SegmentTabLayout.java From FlycoTabLayout with MIT License | 5 votes |
/** 当前类只提供了少许设置未读消息属性的方法,可以通过该方法获取MsgView对象从而各种设置 */ public MsgView getMsgView(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); return tipView; }
Example #17
Source File: SlidingTabLayout.java From FlycoTabLayout with MIT License | 5 votes |
/** 隐藏未读消息 */ public void hideMsg(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { tipView.setVisibility(View.GONE); } }
Example #18
Source File: SlidingTabLayout.java From FlycoTabLayout with MIT License | 5 votes |
/** 当前类只提供了少许设置未读消息属性的方法,可以通过该方法获取MsgView对象从而各种设置 */ public MsgView getMsgView(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); return tipView; }
Example #19
Source File: SegmentTabLayout.java From FlycoTabLayout with MIT License | 5 votes |
public void hideMsg(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { tipView.setVisibility(View.GONE); } }
Example #20
Source File: SlidingTabLayout.java From likequanmintv with Apache License 2.0 | 5 votes |
/** 当前类只提供了少许设置未读消息属性的方法,可以通过该方法获取MsgView对象从而各种设置 */ public MsgView getMsgView(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); return tipView; }
Example #21
Source File: SlidingTabLayout.java From likequanmintv with Apache License 2.0 | 5 votes |
/** 隐藏未读消息 */ public void hideMsg(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { tipView.setVisibility(View.GONE); } }
Example #22
Source File: UnreadMsgUtils.java From likequanmintv with Apache License 2.0 | 5 votes |
public static void setSize(MsgView rtv, int size) { if (rtv == null) { return; } RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) rtv.getLayoutParams(); lp.width = size; lp.height = size; rtv.setLayoutParams(lp); }
Example #23
Source File: UnreadMsgUtils.java From likequanmintv with Apache License 2.0 | 5 votes |
public static void show(MsgView msgView, int num) { if (msgView == null) { return; } RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) msgView.getLayoutParams(); DisplayMetrics dm = msgView.getResources().getDisplayMetrics(); msgView.setVisibility(View.VISIBLE); if (num <= 0) {//圆点,设置默认宽高 msgView.setStrokeWidth(0); msgView.setText(""); lp.width = (int) (5 * dm.density); lp.height = (int) (5 * dm.density); msgView.setLayoutParams(lp); } else { lp.height = (int) (18 * dm.density); if (num > 0 && num < 10) {//圆 lp.width = (int) (18 * dm.density); msgView.setText(num + ""); } else if (num > 9 && num < 100) {//圆角矩形,圆角是高度的一半,设置默认padding lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT; msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0); msgView.setText(num + ""); } else {//数字超过两位,显示99+ lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT; msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0); msgView.setText("99+"); } msgView.setLayoutParams(lp); } }
Example #24
Source File: CommonTabLayout.java From likequanmintv with Apache License 2.0 | 5 votes |
/** 当前类只提供了少许设置未读消息属性的方法,可以通过该方法获取MsgView对象从而各种设置 */ public MsgView getMsgView(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); return tipView; }
Example #25
Source File: CommonTabLayout.java From likequanmintv with Apache License 2.0 | 5 votes |
/** * 设置提示红点偏移,注意 * 1.控件为固定高度:参照点为tab内容的右上角 * 2.控件高度不固定(WRAP_CONTENT):参照点为tab内容的右上角,此时高度已是红点的最高显示范围,所以这时bottomPadding其实就是topPadding */ public void setMsgMargin(int position, float leftPadding, float bottomPadding) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title); mTextPaint.setTextSize(mTextsize); float textWidth = mTextPaint.measureText(tv_tab_title.getText().toString()); float textHeight = mTextPaint.descent() - mTextPaint.ascent(); MarginLayoutParams lp = (MarginLayoutParams) tipView.getLayoutParams(); float iconH = mIconHeight; float margin = 0; if (mIconVisible) { if (iconH <= 0) { iconH = mContext.getResources().getDrawable(mTabEntitys.get(position).getTabSelectedIcon()).getIntrinsicHeight(); } margin = mIconMargin; } if (mIconGravity == Gravity.TOP || mIconGravity == Gravity.BOTTOM) { lp.leftMargin = dp2px(leftPadding); lp.topMargin = mHeight > 0 ? (int) (mHeight - textHeight - iconH - margin) / 2 - dp2px(bottomPadding) : dp2px(bottomPadding); } else { lp.leftMargin = dp2px(leftPadding); lp.topMargin = mHeight > 0 ? (int) (mHeight - Math.max(textHeight, iconH)) / 2 - dp2px(bottomPadding) : dp2px(bottomPadding); } tipView.setLayoutParams(lp); } }
Example #26
Source File: CommonTabLayout.java From likequanmintv with Apache License 2.0 | 5 votes |
public void hideMsg(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { tipView.setVisibility(View.GONE); } }
Example #27
Source File: SegmentTabLayout.java From likequanmintv with Apache License 2.0 | 5 votes |
/** 当前类只提供了少许设置未读消息属性的方法,可以通过该方法获取MsgView对象从而各种设置 */ public MsgView getMsgView(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); return tipView; }
Example #28
Source File: SegmentTabLayout.java From likequanmintv with Apache License 2.0 | 5 votes |
public void hideMsg(int position) { if (position >= mTabCount) { position = mTabCount - 1; } View tabView = mTabsContainer.getChildAt(position); MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip); if (tipView != null) { tipView.setVisibility(View.GONE); } }
Example #29
Source File: SkinMsgView.java From Android-skin-support with MIT License | 5 votes |
public SkinMsgView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); TypedArray ta = context.obtainStyledAttributes(attrs, com.flyco.tablayout.R.styleable.MsgView); mBackgroundColorResId = ta.getResourceId(com.flyco.tablayout.R.styleable.MsgView_mv_backgroundColor, INVALID_ID); mStrokeColorResId = ta.getResourceId(com.flyco.tablayout.R.styleable.MsgView_mv_strokeColor, INVALID_ID); applyBackgroundColorResource(); applyStrokeColorResource(); ta.recycle(); mBackgroundTintHelper = new SkinCompatBackgroundHelper(this); mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr); mTextHelper = SkinCompatTextHelper.create(this); mTextHelper.loadFromAttributes(attrs, defStyleAttr); }
Example #30
Source File: SlidingTabActivity.java From Android-skin-support with MIT License | 4 votes |
@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("后端"); // } // }); }