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?
Inheritance is a mechanism that allows the class to use the states and behavior of another class. In simple words a class derive field and methods from another class.
A style is a collection of attributes that specify the appearance for a single View . A style can specify attributes such as font color, font size, background color, and much more. A theme is a collection of attributes that's applied to an entire app, activity, or view hierarchy—not just an individual view.
Styles in Android allow you to define the look and feel, for example colors and fonts, of Android components in XML resource files. This way you have to set common style attributes only once in one central place.
Right click on res folder, choose New --> Android resource file, set the same name for the new file "styles", in Available qualifiers: choose the last item "Version" and finally set "Platform API level" 21. Save this answer. Show activity on this post. By default, Android Studio doesn't create styles.
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.
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