이 조금 이상한 찾으십시오. 보기 호출기와 단편 인 4 개의 탭이있는 Fragement 활동이 있습니다.안드로이드 목록보기 조각, 항목이 빈 내용을 표시
세 개의 탭 중 목록보기가 있습니다. 내 앱을 열고 첫 번째 목록보기가있는 두 번째 탭과 목록보기의 두 항목으로 스크롤 할 때마다 항목의 내용이 비어 있습니다. 4 번째 탭으로 스크롤하여 두 번째 탭으로 돌아갈 때까지 그 부분이 새로 고침되었습니다. 내 추측입니다. http://postimg.org/image/afhhle3bn/
이 I는 상기리스트를 설정하는 방법이다 : 여기 http://postimg.org/image/84413xncd/
& 컨택 스크롤 백 다시 개방 같은 단편 : 여기
는 처음 열면 번째 단편 조각, helper.list는 목록입니다.public void onResume() {
super.onResume();
if (helper.news != null) {
NewsArrayAdapter newsAdapter = new NewsArrayAdapter(getActivity(), 0, helper.news);
list.setAdapter(newsAdapter);
}
}
가 그리고 이것은 내 사용자 지정 어댑터입니다 :
public class NewsArrayAdapter extends ArrayAdapter<JSONObject> {
private Context context;
private List<JSONObject> items;
MainHelper helper = null;
public NewsArrayAdapter(Context context, int layoutResourceId, List<JSONObject> items) {
super(context, layoutResourceId, items);
this.context = context;
this.items = items;
helper = MainHelper.getHelper();
}
@Override
public View getView(int p, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.single_row_news, parent, false);
TextView name = (TextView) rowView.findViewById(R.id.name);
name.setText(items.get(p).optString("name"));
name.setTypeface(Font.rLight(context));
TextView date = (TextView) rowView.findViewById(R.id.date);
date.setText(Methods.getMethods().getDate(context, items.get(p).optLong("dateAdded"), R.string.date_format_date_month));
date.setTypeface(Font.rLight(context));
ProgressBar spinner = (ProgressBar) rowView.findViewById(R.id.spinner);
ImageView image = (ImageView) rowView.findViewById(R.id.thumbnail);
if (items.get(p).optString("photoURL") == null || items.get(p).optString("photoURL").equals("")) {
image.setVisibility(View.GONE);
spinner.setVisibility(View.GONE);
} else Methods.getMethods().loadImageView(context, items.get(p).optString("photoURL"), image, spinner);
return rowView;
}
}
나는 그들이 보여줄 생각하는 이유 즉 그들과 그게 전부에 약간의 지연이 있으므로 이미지, AsyncTask를에 URL에서로드, 그러나 왜 텍스트가 아닌가?
'helper.news! = null'을 확인 했습니까? – MalaKa
고마워요 @MalaKa, 그게 다야! –
@just_user 인스턴트 메신저 일종의 비슷한 문제에 직면, 어떻게 당신의 문제를 해결 했습니까? 중첩 된 조각으로 목록보기에 항목을 추가 할 때 ListView가 사용되지만 업데이트 된 Textview는 비어 있습니다. 해결책을 나에게 알려주십시오. 고맙습니다. –