To set the divider in the ListView, add the following parameters:
android:divider= "@color/gray"
android:dividerheight= "1DP"
GridView Grid Layout, which by default is not a grid line
Find an online profile and find a way to add gridlines to the GridView
In fact, the grid line is implemented by setting the interval of the GridView subkeys and setting the GridView background color and the child background color, respectively.
Implementation method
- Sets the GridView background color, sets the horizontal inter-directional interval property value android:horizontalspacing, and the vertical direction interval property value android:verticalspacing
- Set the GridView subkey background color
Example code:
1.main.xml
<GridView Android:id= "@+id/gv_words"android:visibility= "Gone"Android:background= "@color/gray"Android:columnwidth= "60DP"Android:numcolumns= "5"Android:listselector= "@null"android:verticalspacing= "1.0px"android:horizontalspacing= "1.0px"android:soundeffectsenabled= "true"Android:smoothscrollbar= "true"Android:stretchmode= "ColumnWidth"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"Android:layout_above= "@+id/llayout2"Android:layout_below= "@+id/llayout1"/>
2.GrivViewItem layout
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "@color/white" > <relativelayout android:layout_width= "50DP"Android:layout_height= "50DP"Android:layout_margin= "5DP" > <TextView Android:id= "@+id/gv_bushou_textview1"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_below= "@+id/itemimage"Android:layout_margin= "1DP"Android:layout_alignparenttop= "true"Android:layout_alignparentleft= "true"Android:layout_above= "@+id/gv_bushou_textview2"Android:layout_toleftof= "@+id/gv_bushou_textview2"android:textsize= "25DP"Android:textcolor= "@color/blue"Android:text= "difficult" > </TextView> <TextView Android:id= "@+id/gv_bushou_textview2"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_below= "@+id/itemimage"Android:layout_alignparentbottom= "true"Android:layout_alignparentright= "true"Android:textcolor= "@color/gray"android:textsize= "10DP"Android:text= "1 strokes" > </TextView> </RelativeLayout></LinearLayout>
3. Running