views:

45

answers:

2

I have a quite problematic UI layout to implement, and I'm not sure if it's even possible using standard UI widgets. It looks something like this:

Picture 1

The green, lined thing is supposed to be a ListView, and the red rectangle is another View. This red View should be scrolled with the ListView, as if it's part of it. Some list-elements should also be narrower, because that embedded View gets in their way. Could you please recommend any ideas? Can this be done somehow with the Android UI framework? I was thinking about some kind of a floating View above the ListView, which reacts to the List's scrolling events too, but it doesn't seem like an elegant solution.

Thanks

A: 

I would set the green rows that the red block overlap and the red block as one big view in the listview. So the items in your listview would be (for the example pic) two green rows, then the view of three green rows and the overlapping red block, and then the remainder of the green rows.

Trying to have the red block on an overlay that scrolls with the listview sounds like more trouble than it's worth.

danh32
That's an interesting idea, although I'd have to hack a quite weird adapter for the list for that. I'll try it out, thanks.
Scythe
Ok, I got it with this solution, it required a rather ugly adapter tho. Thanks!
Scythe
+1  A: 

I don't think you can accomplish that easily with a ListView. You could do the overlay using a FrameLayout, but it would be very awkward to get it to stay probably aligned as the user scrolls.

How many elements are you talking about?

I would probably use a LinearLayout within a ScrollPane to simulate the ListView.

Or, a TableLayout where the overlayed view is contained within a single, complex row.

Mayra