简体   繁体   中英

Android ProgressBar in an each item of a ListView from SQLite

I have a ListView populated with numeric values ​​from database .....

Now for each record I would like to display a colored horizontal bar (ie for example, if the value is 90 bar must be wide about 90% of the screen ... and so on all other values​​)

I think there is no need to use a library type aChartEngine to achieve the purpose .....

Have you heard about?? thanks

this is my code to calculate the percentage

value = value / total *100;                 

For this you have to use custom list view with adapter. Here's a simple code you can use http://www.thepcwizard.in/2012/09/android-creating-custom-listview-for.html

What you're going to have to do is create a custom adapter for your ListView. Here's a tutorial you can use: http://commonsware.com/Android/excerpt.pdf , scroll down to page 22.

Then you can use a ProgressBar for each view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM