Dynamic height viewpager

Made a few tweaks in your code and it is working fine now. 1] onMeasure function wasn’t proper. Use below logic @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (mCurrentView == null) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); return; } int height = 0; mCurrentView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); int h = mCurrentView.getMeasuredHeight(); if (h > height) height = … Read more

Android RecyclerView in ConstraintLayout doesn’t scroll

For a RecyclerView to scroll, one of two things must be true: The RecyclerView has a smaller height than all of its items The RecyclerView is inside a scrolling parent ConstraintLayout is not a scrolling parent, so we have to make sure that the RecyclerView is “too small”, which will cause it to let the … Read more