Closed yandroidUA closed 4 years ago
I'm going to migrate to androidx shortly, and I'll investigate that bug as soon as I have a second. I hope to fix the bug as soon as possible, but I haven't touched this library in over two years. But I don't see any information about using FlowLayoutManager.
That's how i'm using FlowLayoutManager
in my project.
private val ingredientsFlowLayoutManager by lazy {
val flowLayoutManager = FlowLayoutManager()
flowLayoutManager.isAutoMeasureEnabled = true
flowLayoutManager.setAlignment(Alignment.LEFT)
flowLayoutManager
}
private fun setupIngredients() {
ingredientsRecyclerView?.layoutManager = ingredientsFlowLayoutManager
ingredientsRecyclerView?.adapter = ingredientsAdapter
}
in the new version I do not see this problem, I suppose it was for an incompatibility between pre-androidX and androidX If you're still having problems, try forking and modifying the sample app and notify me.
I'm updated version to 1.8.0
and nothing changes, so I forked project and start experiment with it.
Finally, i'm comment this line, inside in MainActivity
:
RecyclerView.ItemDecoration itemDecoration = new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
// outRect.set(5, 5, 5, 5);
}
};
But in XML each view has android:layout_margin="5dp"
, so they must not be so close to each other.
And it looks like:
If i'm adding ItemDecoration
and overriding getItemOffsets
all works fine.
Sorry, I didn't understand if you want the tags close together or far apart? Ok, so it's not a compatibility problem between androidx and legacy stuff, but a hardcoded value problem in the code, as I think you can imagine I didn't write this library, but I based it on existing code. Can you commit your changes?
in fact it was a iusse in the original repo https://github.com/xiaofeng-han/AndroidLibs/issues/21
Yeap, i just want some space between items, like that:
Yeap, seems that it's the same problem in #xiaofeng-han#21. So closing the issue, because root of problem not in your code. Thanks for your attention.
The original code hasn't been updated for years, I was the last code maintainer.
So each item looks like:
But got: