I have an Adnroid library project that defines XML resource.
Let's use a selector drawable as an example (but I have problems with strings, styles, etc).
LibProject/res/drawable/button_selector.xml ... defines a selector
LibProject/res/layout/view.xml .... uses the selector, with no problems
`<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/sign_up_fly_buttons"
android:background="@drawable/button_selector"/>`
Then I want to refer to it in a layout in my App
AppProject/res/layout/view.xml ...
`<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/sign_up_fly_buttons"
android:background="@drawable/button_selector"/>`
But in the App it won't compile or let me reference it. I've tried various namespace incantations to try and refer to it with no luck...
Any ideas?
Addition: I have read that the full-form for such references is: @[packagename:]type/id and if you leave out the package name then the package where this resource file is used.
This an example would be: @com.mylibrary:drawable/button_selector
But it doesn't work for me! There must be something wrong with my library setup/import?
My library is in a separate Eclipse Android project, marked as a Library project, and is referenced from my app as a "Dependent Project" and code is built and links in fine.
OK, found the problem!
In Eclipse, in my Project Properties -> Java Build Path -> "Projects" 'tab' I had the library project added.
BUT, I also had to add it to Project Properties -> Android -> Library area as Library Project.
I had done this for others, but had forgotten to do it here.
Thanks to all who tried to figure out my mistake.
Now the resources are merged in correctly and I can refer to them using the "short-form" format without the package name.