The problem is that the "wrap_content" doesn't seem to be working with the View pager.
Here is the solution:
http://stackoverflow.com/questions/8394681/android-i-am-unable-to-have-viewpager-wrap-content
That's it, don't hesitate to comment, to share your knowledge and to correct me.
Here is the solution:
import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.View; public class CustomViewPager extends ViewPager { public CustomViewPager(Context context) { super(context); } public CustomViewPager(Context context, AttributeSet attrs){ super(context, attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int height = 0; for(int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); int h = child.getMeasuredHeight(); if(h > height) height = h; } heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } }reference:
http://stackoverflow.com/questions/8394681/android-i-am-unable-to-have-viewpager-wrap-content
That's it, don't hesitate to comment, to share your knowledge and to correct me.
How to force the View Pager to wrap its content.