logo
logo
AI Products 
Leaderboard Community🔥 Earn points

Building UI with ConstraintLayout in Android?

avatar
Geek On Java
collect
0
collect
0
collect
3
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
collect
0
collect
3
avatar
Geek On Java