What is difference between Barrier and Guideline in Constraint Layout?

前端 未结 2 1475
粉色の甜心
粉色の甜心 2020-12-07 10:51

Recently trying to implement Constraint Layout but I found Barrier and Guideline works same. Both works like divider.

2条回答
  •  春和景丽
    2020-12-07 11:32

    Official documentation on Barrier:

    A Barrier references multiple widgets as input, and creates a virtual guideline based on the most extreme widget on the specified side. For example, a left barrier will align to the left of all the referenced views.

    Training docs on Barrier:

    Similar to a guideline, a barrier is an invisible line that you can constrain views to. Except a barrier does not define its own position; instead, the barrier position moves based on the position of views contained within it. This is useful when you want to constrain a view to the a set of views rather than to one specific view.

提交回复
热议问题