How to display a “Loading…” text while retrieving items for a ListView

后端 未结 3 941
无人共我
无人共我 2021-02-08 12:33

There are some others applications doing this, like Twitter, Facebook, or even native applications such as Android Market. When you want to display a list of items retrieved fro

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-08 13:16

    When user scrolls to the bottom your adapter's getView should return a view with "Loading.." text and spinning progress. At the same time AsyncTask or background thread should be started that downloads a new chunk of content. When content is ready adapter.notifyDatasetChanged() is called and ListView redisplays all content including the new items.

    So "Loading..." message is just a last item in the ListView.

提交回复
热议问题