我试图弄清楚如何设置列表中的 ratingBar 的值,但无法弄清楚。
我目前正在使用一个简单的适配器来设置文本。
其中mylist是一个哈希图。
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.list_simple,
new String[] { "name"},
new int[] { R.id.item_title});
setListAdapter(adapter);
还有我的xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="@color/white">
<TextView
style="@style/ListHeading"
android:id="@+id/item_title"
android:gravity="left"/>
<RatingBar
style="@style/RatingBarSm"
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isIndicator="true"/>
</LinearLayout>
当我尝试将“评级”添加到简单适配器时,出现此错误。
ERROR/AndroidRuntime(10793): java.lang.IllegalStateException: android.widget.RatingBar is not a view that can be bounds by this SimpleAdapter
我还没有找到任何有用的东西。非常感谢任何帮助或指导。