android - Widget Implementation Advice Needed -
i'm new android , want write widget contains (about)100 columns, each column contains various amount of child views (will determined @ run time via service call). users can scroll horizontally , vertically (similar behavior gridview
horizontal scrolling). child views customized widgets imagebutton
, used load images , data via service call when exposed on screen.
i have implemented 2d scroll view enables users scroll vertically , horizontally. i'm using horizontal linear layout container columns. however, i'm having trouble designing columns. i've thought implementing in following ways:
use vertical linear layout column , subclass of
imagebutton
child view. challenging part how load data , image when button become visible , how dereference them once scrolled off screen. know android doesn't have method tell whether widget on/off screen (likeonexpose(
) method), i'm not sure if it's possible (easily).use sort
adapterview
column.listview
close i'm trying each list view handles own scrolling , it's hard have columns scroll vertically together. i'd prefer use adapter if possible since recycles views, desirable since i'll potentially have thousands of child views , i'm not sure if i'll run out of memory otherwise.
i'd appreciate advice more experienced android developers on how implement described above.
i'm not sure if i'll run out of memory otherwise
it guaranteed run out of memory unless use adapterview
techniques. have 16mb of heap space on many phones, , each widget takes 1-3kb, plus memory bitmap takes. thousands of these = crash.
however, suspect neither of approaches work. stunned if can behavior want, without running out of memory, merely using off-the-shelf widgets base.
if had implement (and thought of that scares heck out of me), i'd start trying grok every line of gridview
's implementation. say, want two-dimensional scrolling gridview
. hence, understand gridview
, figure out how add horizontal scrolling. in theory, subclass of gridview
, though doubt it. more likely, need custom subclass of adapterview
or possibly abslistview
(gridview
's immediate parent).
to put level of effort perspective, gridview
1879 lines long (including comments , whitespace). abslistview
-- in case need reimplement horizontal scrolling -- 4200 lines long.
Comments
Post a Comment