فهرست منبع

修改我的课程显示样式问题

Pq 7 ماه پیش
والد
کامیت
ba5b2d2065
1فایلهای تغییر یافته به همراه15 افزوده شده و 3 حذف شده
  1. 15 3
      student/src/main/java/com/cooleshow/student/ui/course/MineCourseActivity.java

+ 15 - 3
student/src/main/java/com/cooleshow/student/ui/course/MineCourseActivity.java

@@ -124,15 +124,27 @@ public class MineCourseActivity extends BaseMVPActivity<ActivityMineCourseBindin
     }
 
     private void initListener(){
-        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
+        viewBinding.tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
             @Override
             public void onTabSelected(TabLayout.Tab tab) {
-                viewPager.setCurrentItem(tab.getPosition());
+                if (tab != null && tab.getCustomView() != null) {
+                    View customView = tab.getCustomView();
+                    TextView tv_text = customView.findViewById(com.cooleshow.chatmodule.R.id.tv_text);
+                    tv_text.setTextSize(16);
+                    tv_text.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_131415));
+                    tv_text.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+                }
             }
 
             @Override
             public void onTabUnselected(TabLayout.Tab tab) {
-
+                if (tab != null && tab.getCustomView() != null) {
+                    View customView = tab.getCustomView();
+                    TextView tv_text = customView.findViewById(com.cooleshow.chatmodule.R.id.tv_text);
+                    tv_text.setTextSize(16);
+                    tv_text.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_80000000));
+                    tv_text.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+                }
             }
 
             @Override