I have an Android Library Project that contains several styles/themes defined in its styles.xml file.
Normally, when referencing this style in some other xml layout or manifest file, you would just write android:theme="@style/TheNameOfTheStyle"
When using a library project, how does the dependent project properly reference that style now? Just leaving it as android:theme="@style/TheNameOfTheStyle"
gives me an error saying there is no resource found matching that name.
I guess this same question applies for other references like @string, @color etc.
Thanks
Edit: Ok so it appears that you are suppose to reference it just like normal, but the console in eclipse is giving me this error:
Error: No resource found that matches the given name (at 'theme' with value '@style/ThemeName').
(facepalm) Edit
I just needed to "Clean Project" in Eclipse. Now it's working.
XML tags define the data and used to store and organize data. It's easily scalable and simple to develop. In Android, the XML is used to implement UI-related data, and it's a lightweight markup language that doesn't make layout heavy. XML only contains tags, while implementing they need to be just invoked.
eXtensible Markup Language, or XML: A markup language created as a standard way to encode data in internet-based applications. Android applications use XML to create layout files. Unlike HTML, XML is case-sensitive, requires each tag be closed, and preserves whitespace.
XML stands for eXtensible Markup Language, which is a way of describing data using a text-based document. Because XML is extensible and very flexible, it's used for many different things, including defining the UI layout of Android apps.
xml extension, in your Android project's res/layout/ directory, so it will properly compile. More information about the syntax for a layout XML file is available in the Layout Resources document.
Its important to build the project after adding resources (or just have autobuild on) and cleaning the project helps most of the times. Restarting Eclipse when "something" go wrong is a good idea, too.
Also note that Android merges the recources, so the last project that is build "wins" the name. For this reason it's a good idea to prefix ALL resources somehow.
I use IntelliJ and what worked for me is to reference the resource normally and to make sure the library is added as a dependency of the project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With