|
@@ -49,18 +49,18 @@ public class HotNewsFragment extends BaseFragment<FragmentHomeHotNewsLayoutBindi
|
|
|
mHomeHotNewsAdapter.setEmptyView(emptyViewLayout);
|
|
|
mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
|
mViewBinding.recyclerView.setAdapter(mHomeHotNewsAdapter);
|
|
|
- mViewBinding.recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
|
|
|
- @Override
|
|
|
- public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
|
|
- //每行都只有2个
|
|
|
- int childLayoutPosition = parent.getChildLayoutPosition(view);
|
|
|
- if (childLayoutPosition == 0) {
|
|
|
- outRect.top = SizeUtils.dp2px(5);
|
|
|
- } else {
|
|
|
- outRect.top = SizeUtils.dp2px(0);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+// mViewBinding.recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
|
|
|
+// @Override
|
|
|
+// public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
|
|
+// //每行都只有2个
|
|
|
+// int childLayoutPosition = parent.getChildLayoutPosition(view);
|
|
|
+// if (childLayoutPosition == 0) {
|
|
|
+// outRect.top = SizeUtils.dp2px(5);
|
|
|
+// } else {
|
|
|
+// outRect.top = SizeUtils.dp2px(0);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
mHomeHotNewsAdapter.setOnItemClickListener(new OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
|