Is there any way to define multiple style files to avoid a single huge one in Android? Is there any way to define multiple style files to avoid a single huge one in Android? xml xml

Is there any way to define multiple style files to avoid a single huge one in Android?


You are welcome to have as many resources defining styles as you like, at least within reason. There's probably some file-count limit, but it's at least in the hundreds, and possibly in the low billions.

In res/values/, and res/values-*/ directories, filenames do not matter. We use conventions to put resources in files named after the resource, like styles.xml. That is merely an organization system. You are welcome to have as many files with <style> resources as you want, named whatever you want (so long as they are valid resource filenames).

For example, in your Android SDK, if you go to platforms/android-.../data/res/values/ (for some value of ..., based on your installed SDKs), you will see several files that contain style resources:

  • styles.xml
  • styles_*.xml, such as styles_holo.xml
  • themes.xml
  • themes_*.xml, such as themes_material.xml


You can have those styles on any file you want, it won't matter as long as your filenames are valid. So. For example you can create a style file just for buttons. Don't worry about the order, the styles on all files will be parsed and applied.