Two-way scolling list view?
I'm researching creating a view for displaying EPG data. That is the view should:
- have a fixed header column that shows the services,
- have a fixed header row that shows the time and
- a content area that has equal-height 开发者_JAVA百科TextViews of flexible width for showing the actual EPG entries
- Most importantly, scolling vertically must scroll header column as well, scrolling horizontally must scroll header row.
Apart from drawing the whole view myself (inside a scrollable?) I'm totally stumped if there is any good approach I could use involving linear layouts or such.
Any hints are greatly appreciated- please note that I'm and android beginner.
Approach 1: Everything (that is all views) are pre-generated.
Have top and left one-way ScrollViews together with a bidirectional ScrollView and have the scolling be synchronized ( Android: Synchronized scrolling of two different views ). Synchronized scrolling isn't to difficult to do if you've subclassing the ScrollViews and add your own ScrollManager to handle notifications.
Drawback: ScrollViews inside ScrollViews for the main content area do seem to be the desired option. The whole thing will become highly resource intensive as all items need to be created upfront to be available for scrolling.
Approach 1 takes care of view-synchronization for the scrolling, but is a huge resource hog (imagine an EPG with 30+ channels and 100+ events per channel).
Approach 2 One approach for this I could imagine would be- for the main content area- a ListView with a custom ArrayAdapter. Custom adapter would probably return a LinearLayout or similar holding the individual events. That way, scrolling would still work bidirectionally if the ListView is put into horizontal ScrollView and at least the LinearLayouts themselves could be recycled by the ListView.
Are there better approaches?
精彩评论