Java Code Examples for android.support.design.widget.AppBarLayout#getChildAt()

The following examples show how to use android.support.design.widget.AppBarLayout#getChildAt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScrollFlag.java    From Expert-Android-Programming with MIT License 6 votes vote down vote up
public ScrollFlag(AppBarLayout layout) {
  if (layout != null) {
    int i = 0;
    for (int z = layout.getChildCount(); i < z; ++i) {
      View child = layout.getChildAt(i);
      ViewGroup.LayoutParams layoutParams = child.getLayoutParams();
      if (layoutParams instanceof AppBarLayout.LayoutParams) {
        AppBarLayout.LayoutParams childLp = (AppBarLayout.LayoutParams) layoutParams;
        int flags = childLp.getScrollFlags();
        if ((flags & AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL) != 0) {
          vView = child;
          mFlags = flags;
          break;
        }
      }
    }
  }
}
 
Example 2
Source File: ScrollFlag.java    From smooth-app-bar-layout with Apache License 2.0 6 votes vote down vote up
public ScrollFlag(AppBarLayout layout) {
  if (layout != null) {
    int i = 0;
    for (int z = layout.getChildCount(); i < z; ++i) {
      View child = layout.getChildAt(i);
      ViewGroup.LayoutParams layoutParams = child.getLayoutParams();
      if (layoutParams instanceof AppBarLayout.LayoutParams) {
        AppBarLayout.LayoutParams childLp = (AppBarLayout.LayoutParams) layoutParams;
        int flags = childLp.getScrollFlags();
        if ((flags & AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL) != 0) {
          vView = child;
          mFlags = flags;
          break;
        }
      }
    }
  }
}
 
Example 3
Source File: ScrollToolBarBehavior.java    From RxZhihuDaily with MIT License 5 votes vote down vote up
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
   super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    if(child.getChildCount() > 0){
        ViewGroup viewGroup = (ViewGroup)child.getChildAt(0);
        Toolbar toolbar = (Toolbar)viewGroup.getChildAt(1);
        setToolBarStatus(toolbar, dyConsumed);
    }
}