Overlapping a row in a list

How to create this view below.

1) using listview or

2) inflate custom view in scrollview. This is not only a problem.

If the list view, then how to overlap the lines.

Each line has a different color and will come from the webservice api . enter image description here

In listview, in each row I have a problem with the red part, which I noted in the second image. even each background of the line is different and the same color will appear in the next line.

How to make a texture effect in a list?

enter image description here

+6
source share
2 answers

The problem breaks down in many things:

  • How to draw overlapping views? I would try to set negative values ​​for vertical paddings, but this is a wild hunch. In addition, you can simply split the graphics and draw the views as rectangles containing the view N and some parts of the N + 1th view.

  • How about a non-rectangular hit area? You can manually detect clicks by selecting colors, shapes, or simply simplify the visible viewing area to a rectangle.

  • What about visibility detection? ListView shows only visible views. I'm not sure, but most likely it will not work with negative pads or similar hacks.

Personally, I would write a custom view with a ListView-like adapter and dynamic row loading.

+3
source

I tried many ways, and the best and fastest is a simple set of negative divisor for the list:

android:dividerHeight="-100dp" 
+1
source

Source: https://habr.com/ru/post/953234/


All Articles