finds.dev← search

// the find

hongyangAndroid/AndroidAutoLayout

★ 6,644 · Java · Apache-2.0 · updated Nov 2018

[停止维护]Android屏幕适配方案,直接填写设计图上的像素尺寸即可完成适配,最大限度解决适配问题。

AndroidAutoLayout is a deprecated Android screen adaptation library that lets you write px values from design specs directly in XML, converting them at runtime to scaled dimensions based on a reference resolution. Last touched in 2018, the author explicitly recommends migrating to AndroidAutoSize. For anything new, don't use it.

The core idea is genuinely clever: intercept layout inflation and scale all dimension attributes proportionally, so designers can hand off specs without dp conversion math. The extension pattern via AutoLayoutHelper is clean enough that wrapping third-party ViewGroups (CardView, Toolbar) takes about 15 lines. The sample coverage is decent — ListView, RecyclerView, and grid layouts all have working examples. The base_width/base_height attribute for asymmetric scaling shows real thought about aspect ratio edge cases.

Abandoned since 2018 — no support for ConstraintLayout, which became the standard layout container roughly when this project went dark. Every non-standard container (RadioGroup, TabLayout, Toolbar) needs a hand-rolled wrapper class; the autolayout-widget module exists but you're on your own for anything it doesn't cover. The approach manipulates LayoutParams at measure time, which interacts badly with RecyclerView's view recycling if you forget the three-argument inflate call — a silent failure that's easy to miss in code review. Modern alternatives like AndroidAutoSize or just using ConstraintLayout with guidelines handle all of this without the fragility.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →