BackgroundLibrary is an Android framework that generates shape drawables directly through XML attributes without requiring separate shape.xml files.
The tool solves the tedious problem of creating shape and selector XML files for Android views by allowing developers to define shapes, gradients, strokes, and corners directly as attributes on view elements in layout XML. Instead of writing separate drawable resources, developers add attributes prefixed with "bl_" to their views, and the framework generates the corresponding shape drawables at runtime. This eliminates boilerplate and keeps shape definitions colocated with their views.
The framework suits Android projects where developers want to reduce the number of drawable XML files and simplify layout definitions. It works seamlessly with standard Android views and requires no code changes beyond adding XML attributes. The tool supports rounded corners, solid colors, strokes with dashes, gradients with configurable angles and colors, text gradients, and RTL layout mirroring. It provides separate artifacts for projects using the legacy Android Support Library and those using AndroidX.
The project has addressed compatibility issues with newer AndroidX versions and fixed edge cases including white color parsing, RadioButton and CheckBox styling, and text gradient rendering in specific orientations. RTL support was added as an optional feature requiring explicit enablement. The tool maintains active issue response through community channels and includes comprehensive documentation in its wiki rather than inline README examples.