我試圖填補ListFragment與JSON內容,我與我的JSONParcer解析(擴展的AsyncTask)類。我還寫了CustomAdapter(擴展ArrayAdapter)由於具體的列表行佈局。所有的作品都很好,除了有沒有加載圈在列表片段而它的加載(因爲它應該是默認情況下)。我怎樣才能找回來?沒有加載圈ListFragment
這裏是我的適配器代碼:
public class CustomAdapter extends ArrayAdapter<ListItem>
{
private final Activity context;
private final ListItem[] data;
public CustomAdapter(Activity context,ListItem[] itemz)
{
super(context, R.layout.list_item,itemz);
this.context = context;
this.data = itemz;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
LayoutInflater inflater = context.getLayoutInflater();
View rowView = inflater.inflate(R.layout.list_item, null,true);
TextView txtTitle = (TextView) rowView.findViewById(R.id.title);
TextView txtBody = (TextView) rowView.findViewById(R.id.body);
ImageView imageView = (ImageView) rowView.findViewById(R.id.picture);
txtTitle.setText(data[position].getTitle());
txtBody.setText(data[position].getBody());
imageView.setImageBitmap(data[position].getPicture());
return rowView;
}
}
加載後列表的內容仍然可見,即使有setListShown(false);在它之前 – user3090300
@ user3090300 - 確保你調用setListAdapter(adapter);在你調用setListShown(false)之前; – dymmeh