Android examples for User Interface:GridView
get GridView Vertical Spacing
//package com.java2s; import android.widget.GridView; import java.lang.reflect.Field; public class Main { public static int getGridViewVerticalSpacing(GridView view) { // get mVerticalSpacing by android.widget.GridView Class<?> demo = null; int verticalSpacing = 0; try {/* w w w.j a v a 2 s . c o m*/ demo = Class.forName("android.widget.GridView"); Field field = demo.getDeclaredField("mVerticalSpacing"); field.setAccessible(true); verticalSpacing = (Integer) field.get(view); return verticalSpacing; } catch (Exception e) { /** * accept all exception, include ClassNotFoundException, NoSuchFieldException, InstantiationException, * IllegalArgumentException, IllegalAccessException, NullPointException */ e.printStackTrace(); } return verticalSpacing; } }