android - GridView specific items number height -


i have gridview in linearlayout in fragment. i'm using viewpager few fragments, 1 in each page. under viewpager have indicator. i'm using relativelayout root of layout , viewpager above indicator. every of fragments in pager have gridview 4 cells (2 columns x 2 rows).

in phone looks alright, when run app on tablet have lot of empty space under gridview. 1 row of gridview have height in 1/4 of available space, gridview using 1/2 empty space. in every cell have imageview, , reason looks there have margins in sides.

how can measure , set height row or cell or gridview? i've tried this solution not work me.

create file dimens.xml in values directory. put there

     <dimen name="row_height">300dp</dimen>. 

this default size.

create directory values-large inside res folder.

create file dimens.xml in values-large directory. put there

  <dimen name="row_height">600dp</dimen> 

this size tab

and inside layout file add

  android:layout_width="@dimen/row_height" 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -