params.getBehaviour() returns null value
I was playing with the new Android Design Library. The CollapsingToolbarLayout works perfectly. However, I am having trouble setting default state of toolbar as Collapsed. I am trying to implement the solution shown here and here I am calling following code in my onResume of Activity: CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams(); AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) params.getBehavior(); if(behavior!=null) { Log.d("DEBUG", "Behaviour is Not Null "); int[] consumed = new int[2]; behavior.onNestedPreScroll(coordinator