我有下面的文件,R無法識別。無法識別的文件是arrow2.png。該代碼是在pkg2的無法識別R下的資源R
Marker instructionMarker = mMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.arrow2)) //This is where it fails to recognize resource
.flat(true)
.position(instructionAnchorPoint)
.snippet(instruction+"--"+distance));
的文件目錄下
如下
project
/src
/pkg1_mainpkg
some java files
/pkg2
some java files
/pkg3
some java files
/gen
/pkg4
R.java
/pkg1_mainpkg
R.java (contains the id for "arrow2", defined as **public static final int arrow2=0x7f020000;**)
/res
/drawable-hdpi
arrow2.png
...
/drawable-ldpi
arrow2.png
...
/drawable-mdpi
arrow2.png
...
/layout
/values
您的導入可能是錯誤的。你可能會導入android.R。 – njzk2