Issues With Coordinator Layout In Android ?
i m using coordinator layout to achive this video VIDEO REQUIREMENT NOW here is my layout :
- Use this gist by TheLittleNaruto and use it to replace
anroid.support.v4.view.ViewPagerin your layoutxml. This customViewPagerwill wrap child contents, and so is ideal forListViewandRecyclerViewcontent. - Or, if you would instead like the
ViewPagerto occupy any remaining space and not simply wrap content: Inside theActivityclass where you retrieve yourAppBarLayoutandViewPager, and anAppBarLayout.OnOffsetChangedListenerto yourAppBarLayout, and use it to adjust the height of yourViewPagerso that its size adjusts to occupy the space below yourAppBarLayout:
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 ?"