Code example for ViewPager

Methods: getChildAt, getMeasuredWidth, onMeasure, setMeasuredDimension

      super(context, attrs);
   protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
      super.onMeasure(widthMeasureSpec, heightMeasureSpec);
      // find the first child view 
      View view = getChildAt(0);
      if (view != null) {
         // measure the first child view with the specified measure spec 
         view.measure(widthMeasureSpec, heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(), measureHeight(heightMeasureSpec, view));
    * Determines the height of this view 
Stop searching for code, let great code find you!  Add Codota to your java IDE