android - How to get the rectangular perimeter of a view -
i have view , need it's top , bottom location on screen. run following experiment: trying figure out hit rectangle does, run following experiment
int[] location = { 0, 0 }; myview.getlocationonscreen(location); rect outrect = new rect(); myview.gethitrect(outrect); then print , got
outrect.top = 18 outrect.bottom = 138 location[0] = 216 location[1] = 387 i expecting outrect.top , location[1] same.
so, how top , bottom location of rectangular view?
getlocationonscreen() returns x , y position of view relative screen: can calculate bottom position adding value of getheight() y position. gethitrect() returns position of view relative parent, why you're getting different numbers.
Comments
Post a Comment