我正在更新自定義適配器,並且必須將值從字符串數組更改爲列表。將字符串數組更改爲列表<String> - Java/Android
這裏是代碼:
private final List<String> values;
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.comments_listadapter, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.comments_label);
ImageView imageView = (ImageView) rowView.findViewById(R.id.comments_menu);
textView.setText(values[position]); // Needs to Change!
String s = values[position]; // Needs to Change!
imageView.setImageResource(R.drawable.up_down);
return rowView;
}
我已經標明瞭需要改變兩行(我不知道,如果將其更改爲一個列表將需要更多的改變
完美,簡單,輕鬆! – KickingLettuce
如果答案爲您解決,請不要忘記標記爲正確;它有助於他人在未來找到答案! – Eric