Skip to content
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

Dynamic resizing of elements in a grid #78

Open
TheNetos opened this issue Jun 27, 2018 · 1 comment
Open

Dynamic resizing of elements in a grid #78

TheNetos opened this issue Jun 27, 2018 · 1 comment

Comments

@TheNetos
Copy link

TheNetos commented Jun 27, 2018

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:

screenshot_1530090292
screenshot_1530090287

Otherwise, the item simply disappears:

screenshot_1530090298

But if I add a new element to the grid, the missing item appears:

screenshot_1530090313

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)))

@TheNetos
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant