Open TheNetos opened 6 years ago
UPD
After debugging the AsymmetricGridViewAdapter.getView()
, I found that if the rowItems variable contains two or more elements of different heights, all elements that are smaller in height than the first one are simply discarded.
Hi everyone I try to change the individual elements in the grid colSpan and rowSpan. If the element being changed has the same height as the others - all is more or less normal:
Otherwise, the item simply disappears:
But if I add a new element to the grid, the missing item appears:
After change colSpan and rowSpan values, i call method
notifyDataSetChanged()
in the adapter.Question - this is normal behavior and I do something wrong?
UPD: My code (Kotlin): (GridDevicesView - My custom heir to the AsymmetricItem interface, items: List = ArrayList())
asymGrid = mainView.findViewById(R.id.testAsymGrid) asymGrid.requestedHorizontalSpacing = AsymGridUtils.dpToPx(context, 2f) asymGrid.setRequestedColumnCount(3) asymGrid.isDebugging = true asymGrid.isAllowReordering = true asymGridAdapter = GridDevicesAdapter(context, items, asymGrid) // My custom heir of ArrayAdapter asymGridAdapter.add(GridDevicesView(GridTileSize(1/*rowSpan*/,1/*colSpan*/))) asymGridAdapter.add(GridDevicesView(GridTileSize(2,1))) asymGridAdapter.add(GridDevicesView(GridTileSize(2,1)))