Wrap Content View Pager Library For Android. By using this, your view pager will be automatically wrap it's height according to the current page.
By using this your viewpager can be wraped according to the current selected Fragment's view. You don't need to write extra code. Just follow the sample app steps and enjoy :)