java - need to give margin for each grid -
need give margin each grid. given below grid single view. using view in each grid here need 2dp margin between grids. when use android:layout_margin = "2dp" there occurs problem inner grids there 4dp(2dp+2dp)
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:fitssystemwindows="true" android:orientation="vertical" android:gravity="center" android:background="#ffffff"> <imageview android:id="@+id/grid_image" android:layout_width="50dp" android:layout_gravity="center" android:layout_height="50dp" > </imageview> <textview android:id="@+id/grid_text" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="15dp" android:textsize="9sp" android:textcolor="@android:color/black" > </textview> </linearlayout>
if using gridview add horizontalspacing , verticalspacing.
<gridview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/albums_gridview" android:layout_width="match_parent" android:layout_height="match_parent" android:choicemode="singlechoice" android:horizontalspacing="20dp" android:listselector="@android:color/transparent" android:numcolumns="2" android:overscrollmode="never" android:scrollbars="none" android:verticalspacing="20dp" />
or using parent grid view ?
Comments
Post a Comment