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 8732477
In Process

The Archive Base Latest Questions

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

I have a ListAdapter in my android application… I am trying to add a

  • 0

I have a ListAdapter in my android application… I am trying to add a ratingBar to each item in the list with its value set to a value that is contained in [TAG_RATING]. The problem is that the list is showing and the only ratingBar is being stuck at the very bottom of the list and is rather large.

Please see the below code:

   ListAdapter adapter = new SimpleAdapter(
                        AllProductsActivity.this, productList,
                        R.layout.list_item, new String[] { TAG_BID,
                                TAG_NAME,
                                TAG_RATING},
                        new int[] { R.id.pid, R.id.name, R.id.ratingBar});
                    ((SimpleAdapter) adapter).setViewBinder(new MyBinder());
                // updating listview
                setListAdapter(adapter);

then the ViewBinder class looks like this:

   class MyBinder implements ViewBinder{
    public boolean setViewValue(View view, Object data, String textRepresentation) {
        if(view.getId() == R.id.ratingBar){
            String stringval = (String) data;
            float ratingValue = Float.parseFloat(stringval);
            RatingBar ratingBar = (RatingBar) view;
            ratingBar.setRating(ratingValue);
            return true;
        }
        return false;
    }
}

And the list item xml file looks like this:

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >


<TextView
    android:id="@+id/pid"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:visibility="gone" />

<!-- Name Label -->
<TextView
    android:id="@+id/name"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingTop="6dip"
    android:paddingLeft="6dip"
    android:textSize="17dip"
    android:textStyle="bold" />

  <RatingBar
    android:id="@+id/rating"
    style="?android:attr/ratingBarStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingTop="6dip"
    android:stepSize="0.25"
    android:numStars="5"
    />

  • 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-13T09:26:53+00:00Added an answer on June 13, 2026 at 9:26 am

    The RatingBar widget should be placed in the list row layout that you use in the adapter, R.layout.list_item. Right now, you just placed a RatingBar widget below the ListView in the main layout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a android list view in Eclipse that I would like to
I currently have an Android ListView class that displays a list of about 20
I'm trying to list some JmDNS services that I discover in my Android app
I have an Android app with a ListView, and each row in the list
I have developed my first android application. What that application does: I update mysql
Help!! I have a listadapter with a detail view, the problem that I am
I have created a listActivity with my own ListAdapter. The problem is that the
I am making an android application that needs to display all of the items
i have an android application which has a listview for listing 14 items inside
I'm currently working on an android application that uses a subclass of SimpleListAdapter to

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.