Paulius Vindzigelskis
Paulius Vindzigelskis

Reputation: 2181

Android: Overlapping makes list buggy

I have a custom listview and made overlapping very simple: in onDraw method, I set rows' z axis to about 200 and I override getChildDrawingOrder (int childCount, int i). So the result looks like this:

enter image description here

Of course, there are more transitions to look like that, but they are not related to this question.

But as you see, for about a second, the top row (i mean in z axis, which is white) looks buggy. There are imageViews with two state drawable (white when row is in center and blue when outside center) by coordinates. Change drawables programatically by setting background drawable. Bug seems to show when happens transition from one drawable to another: redrawing of bottom piece happens later than main piece of row. I need to make both pieces to change drawables at same time, so there won't be such bugs. Is it android's bug or can I solve it?

Does anyone know why this could happen?

Upvotes: 1

Views: 717

Answers (2)

Paulius Vindzigelskis
Paulius Vindzigelskis

Reputation: 2181

I used nininho suggestion to apply requestLayout() in rotected boolean drawChild(Canvas canvas, final View child, long drawingTime) {} method end and it works.

P.S. put it where you really need it, I put it where goes transitions only, because this method eats lots of resources, while it repaints whole child.

Upvotes: 1

Fabian Knapp
Fabian Knapp

Reputation: 1382

android:cacheColorHint="#00000000"

in your listview. Give it a try.

regards,

Fabian

Upvotes: 0

Related Questions