Skip to content Skip to sidebar Skip to footer

Issues With Coordinator Layout In Android ?

i m using coordinator layout to achive this video VIDEO REQUIREMENT NOW here is my layout :
  1. Use this gist by TheLittleNaruto and use it to replace anroid.support.v4.view.ViewPager in your layout xml. This custom ViewPager will wrap child contents, and so is ideal for ListView and RecyclerView content.
  2. Or, if you would instead like the ViewPager to occupy any remaining space and not simply wrap content: Inside the Activity class where you retrieve your AppBarLayout and ViewPager, and an AppBarLayout.OnOffsetChangedListener to your AppBarLayout, and use it to adjust the height of your ViewPager so that its size adjusts to occupy the space below your AppBarLayout:

Activity class:

//Class variableprivateint windowHeight;
//...
@Override
publicvoidonOffsetChanged(AppBarLayout appBarLayout, int offset) {
    if (windowHeight == 0) windowHeight = getWindow().getDecorView().getHeight();
    int appBarHeight = (int) (appBarLayout.getHeight() + appBarLayout.getY());

    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mViewPager.getLayoutParams();
    params.height = (windowHeight - appBarHeight);
    mViewPager.setLayoutParams(params);

Post a Comment for "Issues With Coordinator Layout In Android ?"