开发者

Handling an embedded view inside a ListView?

开发者 https://www.devze.com 2023-01-19 03:55 出处:网络
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:

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 anot开发者_开发技巧her 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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消