Reputation: 461
I've a ListView
that matches the whole layout (basically a ListActivity
or ListFragment
). I want to show a "Loading..." TextView
at the bottom of the ListView
when it's scrolled to the bottom.
For example, when I scroll down to end of ListView
, it shows a TextView
on the ListView
and says "Loading...", and when It loads new data, the ListView
populates and the TextView
is gone.
Upvotes: 0
Views: 336
Reputation: 9634
I assume you want to display a toast when you scroll to the bottom of your listview...you can simply do it like this
if (yourListView.getLastVisiblePosition() == yourListView.getAdapter().getCount() -1 &&
yourListView.getChildAt(yourListView.getChildCount() - 1).getBottom() <= yourListView.getHeight())
{
//Make the Toast
Toast.makeText(context, "Hey! list bottom reached", Toast.LENGTH_SHORT).show();
}
NOTE: context = yourActivityName.this
Upvotes: 1