问题描述
- 获取两行listview来扩大AlertDialog
-
下面是一个 baseAdapter类,用来扩大一个两行的listview到一个alertDialog,在类的底端的getLayoutInflater
方法有一个语法错误:The method getLayoutInflater() is undefined for the type MyAdapter
。怎么解决呢?
@Override public int getCount() { return listItemsFirstRow.length; } @Override public Object getItem(int position) { return listItemsFirstRow[position]; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null) { convertView = getLayoutInflater().inflate(R.layout.twolinelistview, null); } ((TextView)convertView.findViewById(R.id.text1)).setText( listItemsFirstRow[position]); ((TextView)convertView.findViewById(R.id.text2)).setText( listItemSecondRow[position]); return convertView; } }
时间: 2024-10-27 10:39:16