android - How to create two dimesions scrollable table(view) with oncliks -
i've spent day trying make this. need create large table horizontal , vertical scrolling. each cell of table should clickable.
to make clear picture of trying achieve. scrollable area on center, empty cells , cells numbers should clickable.
i've tried different approaches, end failed:
gridview
:- problem:gridview
elements clickable , scrollable, scroll vertical.horizontalscrollview
placed inverticalscrollview
, whilelinearlayout
, represents table row, placed inhorizontalscrollview
. , program built table adds newlinearlayouts
row row. scrolling implemented manually in parent layout setting coordinates scroll views intouchevent
. i'm using custom scrollviews return false in ontouchevent set coordinates in parent. scrolling works fine, when attach onclickevent cell(textview), breaks. clicking works, scrolling doesn't. i've tried different modifications (onintercepttouchevent) of approach, best result scroll causing click after scrolling.
also table header should fixed vertically. first , last column should fixed horizontally. wonder how google made in google docs app. table scrollable , clickable.
i found working solutuion. instead of ontouchevent
use onscrollchanged
, onhorizontalscrollchanged
manual scroll. approach clicking works fine doesn't work diagonal scroll, because event parameter x 0 in onscrollchanged
(and opposite in onhorizontalscrollchanged
).
Comments
Post a Comment