AndroidAutoLayout is an Android library that converts pixel values from design mockups into percentage-based layouts, enabling consistent scaling across different screen resolutions. At its core, it functions as a pixel-to-percentage converter and screen resolution scaling tool, allowing developers to design layouts using exact pixel dimensions from mockups and have them automatically adapt to any target device.
The library provides several distinctive approaches to screen adaptation. It can generate resolution-specific dimension resource files from a single baseline design, eliminating manual calculations for multiple screen sizes. It also supports per-view dimension overrides, where a view's height or width can be forced to scale relative to the opposite screen dimension for equal physical sizes across devices. For scrolling lists, it automatically sizes RecyclerView and ListView items by converting pixel dimensions to percentage-based values. Custom views can be extended with auto-layout logic so their children also support pixel-based sizing, and existing view hierarchies can be wrapped with auto-layout through a single utility method call.
The library covers percentage-based layout design, where view dimensions are defined as fractions of screen width and height to maintain proportional sizing across diverse device resolutions. It also provides accurate layout previewing by selecting a preview device that matches the mockup's resolution. The documentation and installation surface includes the ability to generate dimension resource files for each target screen resolution from a single baseline file.