How to refers to a drawable from external jar?

Put your problem here if it does not fit any of the other categories.

How to refers to a drawable from external jar?

Postby zjshb » Sat Mar 08, 2008 10:01 am

1. I make a resource project as below:


[res/values/colors.xml]:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <resources>
  2.  
  3.     <drawable name="red">#7f00</drawable>
  4.  
  5.     <drawable name="blue">#770000ff</drawable>
  6.  
  7.     <drawable name="green">#7700ff00</drawable>
  8.  
  9.     <drawable name="yellow">#77ffff00</drawable>
  10.  
  11. </resources>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4



[R.java]:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package test.resource;
  2.  
  3.  
  4.  
  5. public final class R {
  6.  
  7.     public static final class attr {
  8.  
  9.     }
  10.  
  11.     public static final class drawable {
  12.  
  13.         public static final int blue=0x7f020002;
  14.  
  15.         public static final int green=0x7f020003;
  16.  
  17.         public static final int red=0x7f020001;
  18.  
  19.         public static final int yellow=0x7f020004;
  20.  
  21.     }
  22.  
  23. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


2. By eclipse export test.jar

3. aapt p -f -c -M AndroidManifest.xml -j test.jar -S res -I android.jar resource.jar

4. make test project to use drawable in resource.jar, as below:

[res/layout/test.xml]:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2.  
  3.        android:orientation="vertical"
  4.  
  5.        android:layout_width="fill_parent"
  6.  
  7.        android:layout_height="wrap_content">
  8.  
  9.    
  10.  
  11.     <TextView    
  12.  
  13.            android:background="@test.resource:drawable/red" <!-- here -->
  14.  
  15.             android:layout_width="fill_parent"
  16.  
  17.             android:layout_height="wrap_content"
  18.  
  19.             />
  20.  
  21. </LinearLayout>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


There is a error "No resource found that matches the given name (at 'background' with value '@test.resource:drawable/red')" in the above line "android:background="@test.resource:drawable/red""

Any proposes, please let me know. 3q
zjshb
Freshman
Freshman
 
Posts: 3
Joined: Tue Jan 08, 2008 2:58 am

Top

push top

Postby zjshb » Wed Mar 19, 2008 2:11 am

push top
zjshb
Freshman
Freshman
 
Posts: 3
Joined: Tue Jan 08, 2008 2:58 am

Re: How to refers to a drawable from external jar?

Postby miguelo » Tue Oct 20, 2009 10:47 am

zjshb wrote:
...
There is a error "No resource found that matches the given name (at 'background' with value '@test.resource:drawable/red')" in the above line "android:background="@test.resource:drawable/red""
...



how can i fix this issue?, did you solved it?
miguelo
Freshman
Freshman
 
Posts: 6
Joined: Mon Nov 17, 2008 4:05 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 15 guests