第一步:在xml布局GridView
<GridView
android:layout_width="match_parent"
android:layout_marginTop="15dp"
android:verticalSpacing="15dp"
android:numColumns="3"
android:id="@+id/list_home"
android:layout_height="match_parent"></GridView>
第二步:找到布局GridView的控件id
GridView list_home = (GridView) findViewById(R.id.list_home);
第三步:设置adapter
<