Using Android getIdentifier()

后端 未结 3 1820
萌比男神i
萌比男神i 2020-11-27 04:42

I\'ve tried this:

r = Resources.getSystem().getIdentifier(\"ball_red\",\"drawable\",\"com.Juggle2\");
Log.i(\"FindBall\",\"R = \"+r);

And t

3条回答
  •  死守一世寂寞
    2020-11-27 04:49

    For Xamarin users I had the issue where I had added an icon with lower and uppercase letters (e.g. iconVaccine.png ) and was referring to the uppercase name iconVaccine.

    Xamarin will allow you to do this (even though you shouldn't), but when the app gets compiled the name are flattened to lower case, so you must refer to the lower case variant as follows:

    Image Name: iconVaccine.png
    
    Xamarin reference: iconVaccine (as created in Resource.designer.cs, but will fail)
    
    Correct Reference: iconvaccine
    

    Hope that helps!

提交回复
热议问题