开发者_运维问答I want to set a menu option icon for a drawable that is in another jar inside an xml file.
<item android:id="@+id/my_location"
android:title="My Location"
android:icon="@+drawable/my_location">
Instead of drawable/my_location have something like com.somelib.R.drawable.someDrawable.
I can set this in onCreateOptionsMenu but was just wondering if it could be done via the xml file.
I want to set a menu option icon for a drawable that is in another jar inside an xml file.
Drawable resources cannot go in JARs. You are welcome to store images in a JAR and deal with them outside of the resource framework.
I can set this in onCreateOptionsMenu but was just wondering if it could be done via the xml file.
No, because, again, images in a JAR file are not resources, defined as images in res/drawable-*/
in your project. Sorry!
精彩评论