Pq 3 yıl önce
ebeveyn
işleme
99ebba158a

+ 3 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/main/NewHomeFragment.java

@@ -35,6 +35,7 @@ import com.cooleshow.teacher.constants.TeacherInfoConstants;
 import com.cooleshow.teacher.contract.HomeContract;
 import com.cooleshow.teacher.databinding.FragmentNewHomeLayoutBinding;
 import com.cooleshow.teacher.presenter.main.HomePresenter;
+import com.cooleshow.teacher.widgets.HomeHotAlbumItemDecoration;
 import com.cooleshow.teacher.widgets.HomeHotMusicSheetItemDecoration;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.youth.banner.adapter.BannerImageAdapter;
@@ -83,6 +84,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
         manager.setOrientation(LinearLayoutManager.HORIZONTAL);
         mViewBinding.rvHotAlbum.setLayoutManager(manager);
         mAlbumAdapter = new HomeHotAlbumAdapter();
+        HomeHotAlbumItemDecoration hotAlbumItemDecoration = new HomeHotAlbumItemDecoration(0, 0, 0, SizeUtils.dp2px(14), 0);
+        mViewBinding.rvHotAlbum.addItemDecoration(hotAlbumItemDecoration);
         mViewBinding.rvHotAlbum.setAdapter(mAlbumAdapter);
 
         LinearLayoutManager musicSheetManager = new LinearLayoutManager(getContext());

+ 35 - 0
teacher/src/main/java/com/cooleshow/teacher/widgets/HomeHotAlbumItemDecoration.java

@@ -0,0 +1,35 @@
+package com.cooleshow.teacher.widgets;
+
+import android.graphics.Rect;
+import android.view.View;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * Author by pq, Date on 2021/3/18 0018.
+ */
+public class HomeHotAlbumItemDecoration extends RecyclerView.ItemDecoration {
+
+    private int top;
+    private int left;
+    private int bottom;
+    private int right;
+    private int center;
+
+    public HomeHotAlbumItemDecoration(int top, int left, int bottom, int right, int center) {
+        this.top = top;
+        this.left = left;
+        this.bottom = bottom;
+        this.right = right;
+        this.center = center;
+    }
+
+    @Override
+    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
+        //每行都只有2个
+        outRect.top = top;
+        outRect.bottom = bottom;
+        outRect.right = right;
+        outRect.left = left;
+    }
+}

+ 2 - 2
teacher/src/main/res/layout/fragment_new_home_layout.xml

@@ -109,6 +109,7 @@
                     app:layout_constraintTop_toTopOf="parent" />
 
                 <TextView
+                    android:layout_marginTop="2dp"
                     android:id="@+id/tv_score_name"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
@@ -518,8 +519,7 @@
                         android:layout_height="wrap_content"
                         android:layout_marginTop="12dp"
                         android:overScrollMode="never"
-                        android:paddingLeft="@dimen/dp_7"
-                        android:paddingRight="@dimen/dp_7"
+                        android:paddingLeft="@dimen/dp_14"
                         android:scrollbars="none"
                         app:layout_constraintTop_toBottomOf="@+id/tv_hot_album" />
 

+ 0 - 2
teacher/src/main/res/layout/layout_home_hot_album_item.xml

@@ -8,8 +8,6 @@
         android:id="@+id/im_pic"
         android:layout_width="@dimen/dp_94"
         android:layout_height="@dimen/dp_94"
-        android:layout_marginLeft="@dimen/dp_7"
-        android:layout_marginRight="@dimen/dp_7"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         app:qmui_corner_radius="10dp" />