Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9039985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:52:15+00:00 2026-06-16T09:52:15+00:00

I am using a custom XML layout listview_goal_item.xml to represent how I want my

  • 0

I am using a custom XML layout listview_goal_item.xml to represent how I want my ListView items to appear. This XML layout is fed to the adapter as such:

cursor_adapter_goals = new SimpleCursorAdapter(this,
            R.layout.listview_goal_item,
            matrix_cursor_goals, listview_fields, listview_columns);

Everything works great, I can easily understand how to display all the information in listview_fields (the string array for my values) and listview_columns (the string array for the target widgets in my custom ListView layout) because there’s a direct fixed relationship between these items.

I would like to display a fixed “progress” bar graph for each goal item in the ListView. This bar graph would be a simple visual representation of where the user is based on the percentage they’ve achieved their goal, 75% would mean the bar graph would take up 3/4’s of the ListView’s width, 50% 1/2 the width, etc. This is where I am confused.

How should I approach this? Should I create some kind of dynamic 9 patch image? Should I create a simple table with a row that sizes dynamically with a contrasting color on a black table background?

If you could push me in the right direction, both programmatically and in the required XML, I would be much appreciative!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:52:17+00:00Added an answer on June 16, 2026 at 9:52 am

    Add a ProgressBar to the bottom of your item layout, here is one that I use to have as the entire background of a list view item (as an element of a FrameLayout, the other element being a layout with the rest of the list item, TextViews etc):

     <ProgressBar
            android:id="@+id/progressBar"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_margin="0dp"
            android:padding="0dp"
            android:progressDrawable="@drawable/progress_timer" />
    

    Change the layout_* etc according to your needs.

    Notice the drawable used. The drawable referenced is just a layer-list with items with the needed id‘s for the progressbar drawable. Also please notice that the background is set to transparent:

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@android:id/background"
        android:drawable="@android:color/transparent"/>
    <item android:id="@android:id/secondaryProgress">
        <scale
            android:drawable="@color/..."
            android:scaleWidth="100%" />
    </item>
    <item android:id="@android:id/progress">
        <scale
            android:drawable="@color/..."
            android:scaleWidth="100%" />
    </item>
    </layer-list>
    

    In your code you just treat this like any ProgressBar:

    ProgressBar progressBar = (ProgressBar) convertView.findViewById(R.id.progressBar);
    

    When updating:

    progressBar.setMax(100); //100 for example for percent
    progressBar.setProgress(20); //20% done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a custom adapter with a ListView and using a custom layout
I have a custom listView. The main layout xml is something like this: <?xml
I am using a ListView with a custom adapter for displaying items as pairs
I am using the following xml layout for my custom adapter. <?xml version=1.0 encoding=utf-8?>
So I'm using a custom listview through an adapter, and on my Nexus 7
I am using custom adapter which I use for my ListView . After creating
I'm using cursor adapter to get a custom list view.I've two xml files. a.xml
I'm using a ListView with a custom adapter to receive a JSON response and
I'm using a ListView with custom list items (including a button). I have a
I have a listview with a custom row layout. In this custom row is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.