Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

How to code Android Custom ListView with Image and Text

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a tutorial about customizing listview with an image and text. In this tutorial i explained how to load images from remote url and update into listview. Also explained how to design listview with your custom styles and colors instead of using default listview style.

1. Create new project in your Eclipse IDE and fill all the details. File ⇒ New Project

2. Define gradient style

Create 3 files xml named:
- gradient_bg.xml
- list_selector.xml
- gradient_bg_hover.xml
- image_bg.xml
2.1. gradient_bg.xml – Default Background Gradient Style


2.2. gradient_bg_hover.xml – Gradient Style for on hover state


2.3. list_selector.xml – Actual liststyle which combines the above two styles


2.4. image_bg.xml – is for white border around the image in listview


3. Define a listview: open your main.xml file

4. Design single list row:
Create a new XML file under layout folder and name it as list_row.xml for Single ListRow Layout. Right Click ⇒ New ⇒ Android XML File


The above XML will provide you output like below



Download sample source: http://www.9android.net/how-to-code-adroid-custom-listview-with-image-and-text/


See more sample source code tutorial: http://www.9android.net/

I think it will be helpfull for beginner.
 
Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic