0

利用:

public View getView(int position, View convertView, ViewGroup parent) {
final int type = getItemViewType(position);

if(position == 1){
    GridView gridView = new GridView(context);
    gridView.setNumColumns(3);
    AbsListView.LayoutParams params = new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
    gridView.setLayoutParams(params);
    ArrayAdapter<String>  adapter = new ArrayAdapter<String>(context, R.layout.item, R.id.tvText, new String[]{"as","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah","ah"});
    gridView.setAdapter(adapter);
    return gridView;
}

但是gridview没有完整显示。为什么?

截屏:
在此处输入图像描述

我应该喜欢这样:
在此处输入图像描述

项目.xml

4

0 回答 0