Skip to content

Instantly share code, notes, and snippets.

@layerlre
Created April 29, 2015 03:58
Show Gist options
  • Save layerlre/cd283f0e9ac90ea54709 to your computer and use it in GitHub Desktop.
Save layerlre/cd283f0e9ac90ea54709 to your computer and use it in GitHub Desktop.
private void seteGridviewHeight(GridView gridView, float itemCount,float numColumn) {
int row = (int) Math.ceil((itemCount + 1f) / numColumn);
Log.d("debug", "-------row = " + row);
int height = (imageHeight * row); // imageHeight = ความสูงของแต่ละแถวหรือความสูงของรูป
height += (row - 1) * verticalSpacing;
gridView.getLayoutParams().height = height;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment