Closed Shanlovana closed 6 years ago
if i use GridLayoutManager,how can i get correct height?
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { switch (mReAdapter.getItemViewType(position)) { case R.layout.album_item_header: return 3; default: return 1; } } }); rv_fastScroll.setLayoutManager(gridLayoutManager); rv_fastScroll.setAdapter(mReAdapter); @Override public int getViewTypeHeight(RecyclerView recyclerView, int viewType) { //recyclerView.getResources().getDimensionPixelSize(R.dimen.list_item_height) return viewType == R.layout.album_item_header ? DeviceConstant.HEIGHT * ImageSpecial.Spec.PX_90 / ImageSpecial.Spec.PX_HEIGHT : viewType == R.layout.album_item ? DeviceConstant.HEIGHT * ImageSpecial.Spec.PX_248 / 3 / ImageSpecial.Spec.PX_HEIGHT : 0; }
I don't understand the question. You've pasted some code without any context. Is something not working the way you expect it to? What are you trying to achieve? In what way is it not working?
if i use GridLayoutManager,how can i get correct height?