-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lockTableView.setTableDatas()后可能出现列宽不对齐的现象(有图) #18
Comments
你创建表格后,首行的宽度固定下来了,之后加载数据是局部刷新的,就会导致错位。我这边解决办法是用 |
你说的这个原因我之前也发现了。你说的两种解决方案我也都有考虑过,但:1.每列都固定有点麻烦,最终展现出的效果也可能会不太美观;2.如果重新创建表格的话,就又要滚回到第一行从头看了,不能从第一页的最后一条开始往下看,会有点破坏上拉加载更多的使用体验唉。我是有发emial给作者,但一直没收到回复,他应该是不打算再维护这个项目了,T_T |
或者你可以试试找找有没其他库,我是用固定每一列的宽度来实现的,虽然现在也比较少用这个功能了 |
我解决了 ` package com.rmondjone.locktableview;
/
/**
/**
mFristRowBackGroudColor = R.color.table_head;
} textViewParams = new LinearLayout.LayoutParams(LinearLayout.LayoutPar ams.WRAP_CONTENT, mChangeColumns.get(key)); Log.d("changeColumnWidth", textViewParams = new LinearLayout.LayoutParams(LinearLayout.LayoutPar ams.WRAP_CONTENT, (ArrayList) mTableDatas.get(0).clone(); if (isLockFristColumn) { mTableRowDatas.add(mTableDatas.get(i)); }
LinearLayoutManager(mContext); mTableViewAdapter.setCellPadding(mCellPadding); or); mLockHeadView.setBackgroundColor(ContextComp at.getColor(mContext, mFristRowBackGroudColor));
mColumnMaxWidths.get(0)); layoutParams.height = } else { createScollview(mUnLockScrollView,
} }
int width = measureTextWidth(textView, text); TextPaint textPaint = textView.getPaint(); StaticLayout staticLayout = new
linearLayout.setOrientation(LinearLayout.HORIZONT AL); DisplayUtil.dip2px(mContext, mColumnMaxWidths.get(i));
if (mColumnMaxWidths != null && mColumnMaxWidths.size() > 0) { mFristRowBackGroudColor) { this.mFristRowBackGroudColor = this.minRowHeight = minRowHeight; }
}
/
void onItemClick(View item, int position); } |
解决思路就是记录head所有的TextView,然后在initData里动态调整宽度就好了 |
表格数据是通过分页请求接口填充的,现象如图
The text was updated successfully, but these errors were encountered: