How to make a list that can show the changeable content
I have build an application in android. This app needs to display a list of text, but the list of text increase continuously. It means user can see increased list of text. Each text is separated by a horizontal row. It look开发者_开发技巧s like google market when market try to show list of applications. How can i do in this situation ?
You didn't mention where the data came from but let's suppose that you have an ArrayList
of your model Text
.
Steps:
- Add a
ListView
to your layout - Extend
ArrayAdapter
- Set this new adapter to your
ListView
- Modify the array adding/removing new stuff
- Notify the
ListView
that the data has changed using the adapter'snotifyDataSetChanged()
method.
精彩评论