Android API designers are reading my mind!

You know you are working with a generous and well thought out system when there are moments you think the API designers are reading your mind. One of the greatest complements to an API designer’s foresight!

While working on a relatively dynamic layout for an Android app I’m developing, I came across a simple problem with RelatieveLayout. A certain View within the layout must always be aligned with another View … almost always. There will be times when this anchor view might be gone. Without manipulating the layout in code, that is only using the layout XML, how do we tell the layout manager where to align things if this anchor View might be missing? Wouldn’t it be nice if it just knew to fall back on using the parent ViewGroup as the alignment guideline? Well, Android API engineers thought that it would be nice as well: android:alignWithParentIfMissing. Sometimes I’m glad my problems are not as unique. More info here.

Read More