How to add divider in ListView

In order for this code snippet to work, you must add item names starting with “-” where you want to add a divider.

public View getView(int position, View convertView, ViewGroup parent) {

        if(items.get(position).get("name").startsWith("-")){
                View divider = mInflater.inflate(R.layout.progressbar, null);
                return divider;
        }
//Implement the rest of the getView here
}
FacebookGoogle BookmarksTwitterFriendFeedGoogle GmailBlogger PostGoogle ReaderHotmailWordPressShare

Related posts:

  1. Android change listview divider
  2. Android ListView black background when scrolling problem
  3. Check if device has Android Market
  4. Convert dip to px in Android
  5. Android and transparency

Tags: , ,

Leave a Comment