set ViewPager Height - Android android.support.v4.widget

Android examples for android.support.v4.widget:ViewPager

Description

set ViewPager Height

Demo Code

import android.annotation.SuppressLint;
import android.support.v4.view.ViewPager;
import android.view.ViewGroup;

public class Main {

  @SuppressLint("NewApi")
  public static void setViewHeight(ViewPager listView, int height) {

    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height = height;/*from   w ww .  j ava  2s .c  o  m*/
    params.height += 5;// if without this statement,the listview will be a little short
    listView.setLayoutParams(params);
  }

}

Related Tutorials