Browse Source

修改老师端个人主页tab样式

Pq 8 months ago
parent
commit
6af89bfbfa

+ 8 - 3
teacher/src/main/java/com/cooleshow/teacher/ui/homepage/HomePageActivity.java

@@ -49,6 +49,7 @@ import java.util.List;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.constraintlayout.widget.ConstraintLayout;
 import androidx.fragment.app.Fragment;
 
 /**
@@ -135,7 +136,7 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
         TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(viewBinding.tabLayout, viewBinding.viewPager, new TabLayoutMediator.TabConfigurationStrategy() {
             @Override
             public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
-                createTab(tab, titles[position]);
+                createTab(tab, titles[position],position);
             }
         });
         initListener();
@@ -239,7 +240,7 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
                     .navigation();
         }
 
-        if (id == R.id.fl_fans_group){
+        if (id == R.id.fl_fans_group) {
             //粉丝群
             showFansListDialog();
             return;
@@ -251,12 +252,16 @@ public class HomePageActivity extends BaseMVPActivity<ActivityHomePageNewLayoutB
         badgeDesDialog.show();
     }
 
-    private TabLayout.Tab createTab(TabLayout.Tab tab, String text) {
+    private TabLayout.Tab createTab(TabLayout.Tab tab, String text,int position) {
         tab.setCustomView(R.layout.view_homepage_tab_layout);
         View customView = tab.getCustomView();
         if (customView != null) {
             TextView tv_text = customView.findViewById(R.id.tv_text);
+            ConstraintLayout cs_root = customView.findViewById(R.id.cs_root);
             tv_text.setText(text);
+            if (position == 0) {
+                cs_root.setPadding(0, 0, SizeUtils.dp2px(15), 0);
+            }
         }
         return tab;
     }

+ 2 - 2
teacher/src/main/res/drawable/shape_f2f2f2_tr_bl_8dp.xml → teacher/src/main/res/drawable/shape_f2f2f2_tr_bl_6dp.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android">
     <solid android:color="@color/color_f2f2f2"/>
-    <corners android:topRightRadius="8dp"
-         android:bottomLeftRadius="8dp"/>
+    <corners android:topRightRadius="6dp"
+         android:bottomLeftRadius="6dp"/>
 </shape>

+ 1 - 1
teacher/src/main/res/layout/activity_home_page_new_layout.xml

@@ -382,7 +382,7 @@
 
                 <View
                     android:id="@+id/view_line_bottom"
-                    android:layout_marginTop="12dp"
+                    android:layout_marginTop="4dp"
                     app:layout_constraintLeft_toLeftOf="parent"
                     app:layout_constraintTop_toBottomOf="@+id/fl_introduce"
                     android:layout_width="1px"

+ 1 - 1
teacher/src/main/res/layout/item_hp_vip_course_list_layout.xml

@@ -86,7 +86,7 @@
         android:padding="4dp"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintRight_toRightOf="parent"
-        android:background="@drawable/shape_f2f2f2_tr_bl_8dp"
+        android:background="@drawable/shape_f2f2f2_tr_bl_6dp"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content">
         <ImageView

+ 4 - 9
teacher/src/main/res/layout/view_homepage_tab_layout.xml

@@ -1,7 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
+    android:layout_width="wrap_content"
     android:layout_height="wrap_content"
+    android:id="@+id/cs_root"
+    android:paddingStart="15dp"
+    android:paddingEnd="15dp"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools">
     <View
@@ -21,7 +24,6 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent"
-        android:minWidth="32dp"
         android:gravity="center"
         android:includeFontPadding="false"
         android:textSize="@dimen/sp_15"
@@ -30,11 +32,4 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 
-    <View
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        android:layout_width="74dp"
-        android:layout_height="1dp"/>
-
 </androidx.constraintlayout.widget.ConstraintLayout>