質問

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