I have noticed that in our ide , in a module project (com.android.library) we can see the styles are applied if we execute the application on our device , but can't see them in the layout editor.
This would be what my package structure looks like
app (com.android.application)
-res
--values
---styles.xml
module (com.android.library)
-res
--layouts
---module.xml.
Here in my module.xml layout if i try to access a style mentioned in my app module , it shows as an error in the layout editor
It does however compile properly and i can even see the styles applied on the device , however its a hassle if I am not able to see the styles applied in the layout editor.
Your 'module' module has no dependency on 'app' module (where colors are defined) so it is not visible. In order to do it correctly you should create another module with shared styles and make both 'module' and 'app' depend on this shared module.
You can also define attributes in your 'module' module and define values for those attributes in your theme which will be defined in 'app'.
There is attribute defined for colorPrimary ?android:colorPrimary you can reference this attribute in your module and hope that it is set in yours apps theme.
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