Comments (8)
I tried making my 5dp divider into a row in the adapter and it broke the sticky header animation when it reaches a new header.
from flexibleadapter.
Hello @jonathanyee, you can create a custom ItemDecoration
that displays the divider only when the next item is a header (avoiding the very first header of the list), and that should be the way to do it.
We can try to work on it and if it is useful, we can include it in the library.
But you want an easier workaround, and if i understood well maybe you miss to set the same header also to the divider item (defined as ISectionable
). If not, we need to investigate a bit more.
from flexibleadapter.
How would I detect the next item is a header?
from flexibleadapter.
@jonathanyee, The idea is to combine some code of StickyHeaderHelper
class and also the ItemDecoration in the project https://github.com/edubarr/header-decor.
Basically with RecyclerView.getChildAt(position)
and RecyclerView.getChildAdapterPosition(child)
and with my function isHeader(Item) I think it's possible to understand if a next item is a header. Then calculate the margins to create space between the items.
I know it is difficult and it requires time. I will have a look in some weeks if I have time. For the moment it is better if you use the divider item...
from flexibleadapter.
@jonathanyee, I've modified the DividerItemDecoration
to add a gap space (offset) only at the end of a section with items, now if you don't want the middle lines, the code in onDraw()
method should be skipped to be executed. If you desire, would you customize that class for this library? lot of improvements can be done, for instance:
- support for horizontal
- accepting a drawable object
from flexibleadapter.
The modification I've added seems to work only with LinearLayout, with GridLayout it doesn't create the gap for the previous items that are on the same line of the last item... so, for Grid it must be fixed! Any idea?
from flexibleadapter.
I'm sorry, can't think of any.
from flexibleadapter.
Available from v5.0.0-b6.
from flexibleadapter.
Related Issues (20)
- Sticky headers lag when using beginDelayedTransition()
- Sticky header item view
- Double sticky header
- Support theme refences on fast scroller
- Probable major bug in private filterItemsAsync() method.
- Items are not deleted after filter
- Elevation is not applied correctly with getActivationElevation HOT 1
- Comment of return value of 'OnItemClickListener.onItemClick()' may mislead.
- 'SelectableAdapter.toggleSelection()' doesn't toggle selection in SINGLE mode. HOT 1
- FastScroller - setHandleAlwaysVisible does not effect
- Example of eu.davidea.flexibleadapter.FlexibleAdapter.DiffUtilCallback implementation HOT 1
- [Sticky headers]The real Header is invisiable
- How to collapse all items at start? HOT 1
- FYI: Bintray is shutting down on February 1st 2022 HOT 17
- Adding random text to item when scroll list
- flexibleadapter with sqlite
- AndroidX - Layout Inflation Failing on dependency later than com.google.android.material:material:1.0.0
- Further support? HOT 4
- Trying to get in touch regarding a security issue
- Sticky header items [Image Views, Text views with clicks] with expand/collapse feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flexibleadapter.