Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android - ListView

Paresh Mayani
September 15, 2012

Android - ListView

My session on Android - ListView in GDG Ahmedabad orientation dated on 15th September 2012.

Paresh Mayani

September 15, 2012
Tweet

More Decks by Paresh Mayani

Other Decks in Programming

Transcript

  1. Android - ListView
    http://www.technotalkative.com/
    http://about.me/paresh.mayani
    @pareshmayani

    View Slide

  2. Simple ListView
    http://www.TechnoTalkative.com

    View Slide

  3. Fancy ListView
    http://www.TechnoTalkative.com

    View Slide

  4. Custom ListView
    http://www.TechnoTalkative.com
    Step 1: create XML layout for ListView.
    Step 2: Create Row file for ListView items
    Step 3: Create custom adapter for ListView
    Step 4: Create MainActivity.java file
    Download: http://www.technotalkative.com/android-
    asynchronous-image-loading-in-listview/

    View Slide

  5. Custom ListView
    http://www.TechnoTalkative.com
    Step - 1: create XML layout for ListView.

    View Slide

  6. Custom ListView
    http://www.TechnoTalkative.com
    Step - 2: Create Row file for ListView items

    View Slide

  7. Custom ListView
    http://www.TechnoTalkative.com
    3) Create custom adapter by extending BaseAdapter
    or ArrayAdapter

    View Slide

  8. Follow ViewHolder pattern
    http://www.TechnoTalkative.com

    View Slide

  9. Asynchronous image loading (Lazy loading of
    images)
    http://www.TechnoTalkative.com
    Download libraries available:
    1) https://github.com/thest1/LazyList
    2) Universal Image Loader for Android
    => https://github.com/nostra13/Android-Universal-
    Image-Loader
    3) Novoda’s Image Loader
    https://github.com/novoda/ImageLoader

    View Slide

  10. Remember attributes
    http://www.TechnoTalkative.com
    Android listview produces black highlighting over text when scrolling. How
    to stop this?
    => android:cacheColorHint="@android:color/transparent”
    How can i display drawable or color to draw between list items?
    => android:divider="@android:color/transparent“
    How can i increase/decrease height of the divider?
    android:dividerHeight="10dp“
    How can i set drawable to indicate the currently selected item in the list?
    => android:listSelector="@android:color/transparent"

    View Slide