4 ms·
I don't know much about Android's layout, but from what I have seen, it looks rather ad-hoc. For example, LinearLayout (http://developer.android.com/reference/a
by ridiculous_fish 14y ago
I don't know much about Android's layout, but from what I have seen, it looks rather ad-hoc. For example, LinearLayout (http://developer.android.com/reference/android/widget/LinearLayout.html http://developer.android.com/reference/android/widget/Linear...) looks to be a core layout class. It has boolean properties like "baselineAligned" and "measureWithLargestChild;" these appear to have been added as needs arose, instead of being part of a general layout theory.
Autolayout, on the other hand, has a more general approach of establishing relationships between properties of views. Baseline alignment then just falls out: make view1.baseline = view2.baseline, or view1.top = view2.top for top alignment if you prefer. Equal widths fall out too: view1.width = view2.width. If you want a vertical stack you can write view1.bottom = view2.top. If you want a fixed aspect ratio (say, 4/3), you can write view1.width = view1.height * 4/3.
The result is that it's possible to directly express complex layout ideas. For example, "make three buttons baseline aligned, 10 pixels apart, all of them equal width, none of them clipping their labels. If they cannot fit, then in turn: shrink the padding down to 4 pixels, don't require them to be equal width, truncate the first button's label, or lastly then grow the window / make the view scrollable, until they fit."
That's an unrealistically elaborate example, but with autolayout it can be done entirely in IB, without any code at all. I am guessing with Android it would take a fair amount of manual work.
So my view from a distance is that the autolayout approach is more general and elegant, while the Android approach may handle simple cases easily, but is more ad-hoc and random.
- cageface 14y agoYou should try actually building some complex Android UIs. You might find it eye-opening after working with iOS for a long time. I certainly did. It's true that AutoLayout's systems of interdependent linear equations are strictly more powerful than Android's structural layouts but they're a far more awkward solution to the vast majority of common UI layout problems. In practice Android UIs are far, far easier to write and maintain. Debugging the kind of complex AutoLayout schemes you describe can quickly become a nightmare. The structural approach taken by Android and WP is far more natural for the kinds of UIs you actually find in the field. Also, Android's CSS-like style system makes it far easier to define app-wide constants like grid spacing, margins, button padding etc and to change them in one place.
- vor_ 14y agoI haven't developed for Android, but I do know that the interfaces for several major apps I saw were hilariously bad on large screens--literally just the small-screen phone interfaces floating in empty space. For example, Skype: http://i.imgur.com/4XwVmjy.jpg http://i.imgur.com/4XwVmjy.jpg
- bookwormAT 14y agoThat screenshot is Skype from 2011. This is how the app looks today: http://phandroid.s3.amazonaws.com/wp-content/uploads/2012/11/skype-for-android-tablets.jpg http://phandroid.s3.amazonaws.com/wp-content/uploads/2012/11... Responsive design is one of Android's most fundamental design principles. It just took a while (and a few million tablet sales) for developers to take the platform seriously. Most new android apps are responsive these days. And those companies that maintain their existing apps are busy adding big screen support.
- vor_ 14y agoThe Skype screenshot is from last year. It was't the only one; another was the Netflix app, and Facebook was really bad: http://i.imgur.com/fSQYQex.png http://i.imgur.com/fSQYQex.png I'm glad to hear that companies are busy adding big screen support, though that support is arguably coming late. The main point is that an Android app's interface could be stretched across anything, and this has certainly been a design obstacle in the past.
- cageface 14y agoIt's not an obstacle it's just laziness. Unlike the iPad you basically get a usable tablet UI for free with Android. Android's fragment API makes it a lot easier than he iPad to adapt to a proper tablet UI if you want.
- vor_ 14y ago> Unlike the iPad you basically get a usable tablet UI for free with Android. I just posted two screenshots showing otherwise. > Android's fragment API makes it a lot easier than he iPad to adapt to a proper tablet UI if you want. And this is just ridiculous. Regardless of whether you prefer iPads or Androids, iPads are most decidedly easier to design tablet UIs for because there are so few screen sizes.