RecyclerView height issue in API 17 and API 16 - Android -
i implementing recyclerview
in app show list of stuff. on lg nexus 5 (android 5.1 m), if set target sdk 16 or 17 (basically simulate what's happening on phones api 16, 17) row height of list changes dramatically.
however, doesn't occur on api 18 or 18+. cannot figure out why happens , optimal approach tackle issue.
one more thing: use imageview
inside list row. happening when in imageview
loading images server. use imageloader
library this. if use static images, don't have issue
"if use static images, don't have issue" when using static images, loaded in during onlayout()
imageview
. when image loaded in during layout, affects measured size in onmeasure()
pass.
when image isn't set statically(i.e. pulled down on network async), imageview
can't rely on size of image determine measured size. when image loaded, shrunk fit within existing measured imageview
.
solutions:
- specify
minheight
onimageview
or row layout - or specify fixed height on
imageview
or row layout
if know size want row, should use fixed height.
there default styles recyclerview
can set attributes minheight
row layout can vary across api versions. without explicitly setting fixed or minheight
yourself, can see different behavior across api versions.
Comments
Post a Comment