logo
logo
Sign in

Building UI with ConstraintLayout in Android?

avatar
Geek On Java
Building UI with ConstraintLayout in Android?

In this article I’d like to highlight recent additions to ConstraintLayout in Android Studio 2.3 (Beta): chains and ratios, as well as give some general ConstraintLayout tips and tricks.

It lets you toggle between three chain modes: Spread, Spread Inside, and Packed Chain.

If you have a Packed chain, you can adjust the horizontal (or vertical) bias to move all elements of the chain left and right (or up and down).

restrict a View to a set width to height ratio, without the overhead of the additional ViewGroup in your hierarchy.

To set a ratio for any view inside a ConstraintLayout:

Make sure at least one of the size constraints is dynamic, i.e.

collect
0
avatar
Geek On Java
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more