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.ViewPager
in your layoutxml
. This customViewPager
will wrap child contents, and so is ideal forListView
andRecyclerView
content. - Or, if you would instead like the
ViewPager
to occupy any remaining space and not simply wrap content: Inside theActivity
class where you retrieve yourAppBarLayout
andViewPager
, and anAppBarLayout.OnOffsetChangedListener
to yourAppBarLayout
, and use it to adjust the height of yourViewPager
so 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 ?"