开发者

Is it possible to set an android icon from a drawable in a separate jar?

开发者_运维问答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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜