Javier Manzano
Javier Manzano

Reputation: 4821

Style inheritance in Android

I know that a style can be inherited in android via the "parent" property but all the examples I've found are doing this with an Android built-in style. Can I use it with my own styles?

Upvotes: 10

Views: 7545

Answers (2)

Barry Fruitman
Barry Fruitman

Reputation: 12656

You can always use your own styles as a parent, but it's not recommended. From the docs:

... you should always inherit your core app styles from the Android Support Library. The styles in the support library provide compatibility with Android 4.0 (API level 14) and higher by optimizing each style for the UI attributes available in each version.

Basically your styles may not be compatible with every version of Android. I recommend using a core style as your root style, and customize it any way you want in child styles.

Upvotes: 0

Tim
Tim

Reputation: 6712

it's totally possible to use your own styles as parent. This totally makes sense if you want to provide different themes with the same base theme.

Upvotes: 6

Related Questions