使用する:
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;
}
ただし、グリッドビューは完全には表示されません。なんで?
スクリーンショット:
そして、私はこれが好きです: