开发者

Scrollable parent with ListView child

开发者 https://www.devze.com 2022-12-14 02:50 出处:网络
I know it\'s considered taboo to place a ListView inside a scrolling container, so is there any \"proper\" way to accomplish scrolling of a container that has a ListView child in it?An example layout

I know it's considered taboo to place a ListView inside a scrolling container, so is there any "proper" way to accomplish scrolling of a container that has a ListView child in it? An example layout would look something like:

Header
---
"Sub" header
---
ListView with list items
---
Footer

Header and Footer need to remain static on the screen, and the middle content (Subheader and ListView) should scroll between them. I can't have just the ListView scrollable, because the subheader takes up too much space. As it is currently, the Header comes from an <include />, the Subheader contains several views including an Image and some text, and the ListView (actually part of a ViewFlipper) would contain an indeterminate number of items. The Footer has a couple buttons/tabs that are used to control the ViewFlipper (only one of the vi开发者_StackOverflow社区ews in the flipper is a ListView).

The only way I can think of to accomplish this efficiently would be to place the Subheader inside the ListView as the first item -- is there any better way?


I know it's considered taboo to place a ListView inside a scrolling container

It's not "taboo", it just will never work.

The only way I can think of to accomplish this efficiently would be to place the Subheader inside the ListView as the first item -- is there any better way?

You could use addHeader() on ListView to set up your "Subheader" as a ListView header.

0

精彩评论

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