finds.dev← search

// the find

hongyangAndroid/android-percent-support-extend

★ 1,792 · Java · Apache-2.0 · updated Apr 2018

a extends lib for android-percent-support(Google百分比布局库的扩展)

A community extension to Google's now-deprecated percent-support library for Android that adds percentage-based sizing anchored to screen width or height rather than parent dimensions. Solves the real annoyance of `30%w` meaning different things on a portrait vs landscape screen, and adds padding, min/max dimensions, and text size as percentage targets. Aimed at Android devs who were already using the official percent-support lib and hit its limitations.

The `%w`/`%h`/`%sw`/`%sh` suffix system is a clean solution to the aspect-ratio problem — anchoring width and height to the same reference dimension makes square views and fixed-ratio images trivially easy. ScrollView support is handled pragmatically: instead of pretending UNSPECIFIED height works, it falls back to screen height, which is what you actually want 90% of the time. The library is a thin wrapper that doesn't change the upstream API, so migration is a one-line dependency swap. The README is in Chinese but the code examples cover every attribute with working XML.

The underlying `android.support.percent` library was deprecated in API 26 (2017) and removed entirely; this extension is dead on arrival for any project targeting modern Android, where ConstraintLayout handles all of this natively and better. Last commit was April 2018, no releases since 1.1.1, and it still references `compile` instead of `implementation` in Gradle — it hasn't been touched since Gradle dropped that syntax. There are zero tests beyond the autogenerated `ApplicationTest.java` stub. The ScrollView behavior (silently switching the height reference to screen height) is undocumented behavior that will surprise anyone who doesn't read the README carefully.

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 →