-1

我想使用以下代码更改我的 gridview 的字体:

GridView gv = (GridView) findViewById(R.id.gridView1);
String[] numbers = new String[] {
                       "1" , "2" ,"3","4","5","6","7","8","9","10"
                   };

ArrayAdapter adapter = new ArrayAdapter(this, 
                                        android.R.layout.simple_list_item_1,
                                        numbers);
gv.setAdapter(adapter);
4

1 回答 1

0

我认为这是你需要的:

“您必须更改网格视图的 baseadapter 类中的字体大小。

像这样:

public View getView(int position, View convertView, ViewGroup parent) {
      TextView tv;
if (convertView == null) {
    tv = new TextView(context);
    tv.setLayoutParams(new GridView.LayoutParams(100, 80));
    tv.setTextSize(20);   //text size in gridview
}

网格视图只显示任何

gridview.setAdapter(new MyAdapter (thi)); //MyAdapter class is where the getView method run sets the setAdapter to contain."
于 2013-09-15T06:48:46.000 回答