Layout-Based: Layout-Based behaviors are used to shift one view to some other place when you perform a certain operation.So, broadly these behaviors can be classified into two types: Some of the common Material Design behaviors are sliding drawers, swipe-dismissal, floating action button, a sticky button that stick on some other view. We create a particular behavior for a particular view and these behaviors are responsible for animations between the views. Whenever a view is interacting with the other then it is done with the help of Behaviors. After looking at the examples, one question that might come in your mind is that how the CoordinatorLayout knows what to do with the child present in CoordinatorLayout? Let’s try to find the answer. We have seen some examples of CoordinatorLayout in the introduction section of the blog. CoordinatorLayout controls the animation and transactions of various child elements with one another. Now, with the help of the CoordinatorLayout, the interaction between the views become very easy even in the case of animation. What is Coordinator Layout?Īccording to the official documentation of Android: CoordinatorLayout is a super-powered FrameLayout.Īt the Google I/O 2015, Google introduced Coordinator Layout to remove the difficulties of having more than one layouts in FrameLayout. If you want to see the project, then you can find the project here. The following is the timeline of the blog:
We will see various use-cases of the Coordinator Layout with the help of an Android Studio project. So, welcome to MindOrks! In this blog, we are going to learn about CoordinatorLayout in Android. Here, we can see that one view is going over the other and the transaction or animation between these views is very smooth. Another example of Coordinator Layout can be seen below: This is done with the help of CoordinatorLayout. Now, scroll up and the profile pic will be visible again. Did you see any change in the profile pic? Yeah, it disappeared and now only the contact name is visible. You would see the profile pic and other details of that contact. Now, open any chat and click on the name of the chat. To have a clear understanding of the usage of Coordinator Layout, please open your WhatsApp application. By using Coordinator layout you can easily handle and animate the transitions of views present in a Coordinator Layout. So, in order to handle the views(especially the view that is having some motion) in a better way, Android introduced a new layout called the CoordinatorLayout. The reason behind this is, you have to explicitly handle the motions or you may say the animations of all the views that are present on a particular page of your mobile application. Also, it is advised not to use more than one element in our FrameLayout. You all must have used FrameLayout in your Android applications and must be familiar with the difficulties that we face while managing the views in a FrameLayout especially when having some view over the other and things become worse when there is some animation present in the views.