문제

I would like to obtain ImageView dimensions during bindView method.

Unfortunately during bindView measured height and width are 0.

I need those dimensions to request specific image width and height from web.

도움이 되었습니까?

해결책

Before your AdapterView starts recycling views, the views would have not been layered-out on the screen yet, so they will be width and height of zero, because it really is zero.

After your bindView starts to receive recycled views, they will have width and height, but then it's too late.

On those situations you must find a different way to calculate their size, for example, you can make it be a fixed value in DP for every view and just use that value. Example:

int size = context.getResources().getDimensionPixelSize(R.dimen.img_size);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top