Commit 1567df13 authored by 陈前's avatar 陈前

UI

parent 1688455d
...@@ -48,7 +48,7 @@ public class MyselfFragment extends BaseFragment<MainPresenter, FragmentMyselfBi ...@@ -48,7 +48,7 @@ public class MyselfFragment extends BaseFragment<MainPresenter, FragmentMyselfBi
integers.add(110); integers.add(110);
integers.add(111); integers.add(111);
mMySelfRecyclerAdapter = new MySelfRecyclerAdapter(getActivity(), integers); mMySelfRecyclerAdapter = new MySelfRecyclerAdapter(getActivity(), integers);
mViewBinding.fragmentMyselfRecycler.addItemDecoration(new RecyclerViewUtil.ListCardItemDecoration(getActivity(), 1, getResources().getColor(R.color.gray_kongming)));
mMySelfRecyclerAdapter.bindToRecyclerView(mViewBinding.fragmentMyselfRecycler); mMySelfRecyclerAdapter.bindToRecyclerView(mViewBinding.fragmentMyselfRecycler);
mMySelfRecyclerAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { mMySelfRecyclerAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override @Override
......
package com.xingdata.zzdpos.util;
import android.content.Context;
/**
* Created by Administrator on 2018/1/22.
*/
public class DensityUtil {
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* 根据手机的分辨率从 px(像素) 的单位 转成为 dp
*/
public static int px2dip(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
}
...@@ -140,6 +140,7 @@ public class RecyclerViewUtil { ...@@ -140,6 +140,7 @@ public class RecyclerViewUtil {
private StatisticsCallback mStatisticsCallback; private StatisticsCallback mStatisticsCallback;
private int mDividerHight = 1; private int mDividerHight = 1;
private Paint mColorPaint; private Paint mColorPaint;
private Context mContext;
public final int[] ATRRS = new int[]{android.R.attr.listDivider}; public final int[] ATRRS = new int[]{android.R.attr.listDivider};
...@@ -147,6 +148,7 @@ public class RecyclerViewUtil { ...@@ -147,6 +148,7 @@ public class RecyclerViewUtil {
public StatisticsItemDecoration(Context context) { public StatisticsItemDecoration(Context context) {
final TypedArray ta = context.obtainStyledAttributes(ATRRS); final TypedArray ta = context.obtainStyledAttributes(ATRRS);
this.mDividerDarwable = ta.getDrawable(0); this.mDividerDarwable = ta.getDrawable(0);
mContext = context;
ta.recycle(); ta.recycle();
} }
...@@ -189,13 +191,13 @@ public class RecyclerViewUtil { ...@@ -189,13 +191,13 @@ public class RecyclerViewUtil {
SectionEntity sectionEntity = mStatisticsCallback.getItem(position); SectionEntity sectionEntity = mStatisticsCallback.getItem(position);
if (sectionEntity != null) { if (sectionEntity != null) {
if (!sectionEntity.isHeader) { if (!sectionEntity.isHeader) {
final int left = child.getLeft() - params.leftMargin - mDividerHight + 200; final int left = child.getLeft() - params.leftMargin - mDividerHight + DensityUtil.dip2px(mContext, 65);
final int right = child.getRight() + params.rightMargin; final int right = child.getRight() + params.rightMargin;
int top = 0; int top = 0;
int bottom = 0; int bottom = 0;
top = child.getBottom() + params.bottomMargin +1; top = child.getBottom() + params.bottomMargin + 1;
bottom = top + mDividerHight; bottom = top + mDividerHight;
//画分割线 //画分割线
mDividerDarwable.setBounds(left, top, right, bottom); mDividerDarwable.setBounds(left, top, right, bottom);
......
...@@ -32,19 +32,20 @@ ...@@ -32,19 +32,20 @@
app:layout_constraintStart_toStartOf="@id/item_tv" app:layout_constraintStart_toStartOf="@id/item_tv"
app:layout_constraintTop_toTopOf="@id/item_tv" /> app:layout_constraintTop_toTopOf="@id/item_tv" />
<View <View
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/view_line_L050" android:layout_height="@dimen/all_padding"
android:background="@color/gray_kongming" android:background="@color/gray_zhouyu"
app:layout_constraintBottom_toBottomOf="@id/item_tv"
app:layout_constraintEnd_toEndOf="@id/item_tv" app:layout_constraintEnd_toEndOf="@id/item_tv"
app:layout_constraintStart_toStartOf="@id/item_tv" /> app:layout_constraintStart_toStartOf="@id/item_tv"
app:layout_constraintTop_toBottomOf="@id/item_tv" />
<View <View
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/all_padding" android:layout_height="@dimen/view_line_L050"
android:background="@color/gray_zhouyu" android:background="@color/gray_kongming"
app:layout_constraintTop_toBottomOf="@id/item_tv" app:layout_constraintBottom_toBottomOf="@id/item_tv"
app:layout_constraintEnd_toEndOf="@id/item_tv" app:layout_constraintEnd_toEndOf="@id/item_tv"
app:layout_constraintStart_toStartOf="@id/item_tv" /> app:layout_constraintStart_toStartOf="@id/item_tv" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment