android - get horizontal and vertical spacing in gridview -


i implementing grid view in application.and want horizontal spacing between consecutive rows , vertical spacing between consecutive columns within grid view using java code.

is possible? there direct methods spacing?

you can use android:verticalspacing , android:horizontalspacing in gridview tag , provide spacing per requirement.

for example:

<gridview     android:layout_height="wrap_content"     android:id="@+id/gridview1"     android:layout_width="match_parent"     android:numcolumns="auto_fit"     android:horizontalspacing="10dp"       // space between 2 items (horizontal)     android:verticalspacing="10dp">        // space between 2 rows (vertical) 

on java try:

"gridviewname".gethorizontalspacing() "gridviewname".getverticalspacing() 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -