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
Post a Comment