Get android.R.attr.listPreferredItemHeightLarge in picasso (Resources$NotFoundException error)

StackOverflow https://stackoverflow.com/questions/21812695

質問

According to the javadoc of Picasso the constructor of resizeDimen() is:

public RequestCreator resizeDimen(int targetWidthResId,
                              int targetHeightResId)

So use a system attribute in my code:

Picasso.with(context).load(URL)
    .resizeDimen(android.R.attr.listPreferredItemHeightLarge, 
                 android.R.attr.listPreferredItemHeightLarge)
    .centerCrop()
    .into(holder.Logo);

But I get:

E/AndroidRuntime(7588): android.content.res.Resources$NotFoundException: Resource ID #0x1010386

Which I don't understand since a typical System.out.println(android.R.attr.listPreferredItemHeightLarge); will return the id of the object in practice:

I/System.out(7588): 16843654

Why do I get the error here?

役に立ちましたか?

解決

It has to be a Dimension resource id (a <dimen> resource), not a Dimension attribute id.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top