Android 使用GridView创建按钮矩阵
有人能帮我用GridView制作代码中的按钮矩阵吗。我尝试使用TableLayout,但它看起来不像Java中的GridLayout(无法在同一行的按钮之间添加空格)Gridview.xmlAndroid 使用GridView创建按钮矩阵,android,Android,有人能帮我用GridView制作代码中的按钮矩阵吗。我尝试使用TableLayout,但它看起来不像Java中的GridLayout(无法在同一行的按钮之间添加空格)Gridview.xml <GridView android:id="@+id/GridView01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:columnWidth="90
<GridView
android:id="@+id/GridView01"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:columnWidth="90dp" android:numColumns="auto_fit" android:verticalSpacing="10dp" android:horizontalSpacing="10dp" android:stretchMode="columnWidth" android:gravity="center">
</GridView>
GridView.java
gv = (GridView) findViewById(R.id.GridView01);
gv.setAdapter(<your adapter of button names>);
gv.setOnItemClickListener(<listener for each item click>);
gv=(GridView)findviewbyd(R.id.GridView01);
gv.setAdapter();
gv.setOnItemClickListener();