私はリストにあるratingBarの値を設定する方法を理解しようとしていますが、それを理解することはできませんでした。Android:ListAdapter内でratingBarの値を設定するにはどうすればよいですか?
私は現在、テキストを設定するために簡単なアダプタを使用しています。
マイリストはハッシュマップです。
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
私はこれに関して何か有用なものを見つけることができませんでした。どんな助けや方向性も高く評価されています。
運がいいですか?おそらく、カスタムリストアダプターが必要です。 –
私は同じことを考えているが、まだ試してみたことがない – user401183
私は拡張アダプタsimpleadapterを作らなければならなかった – user401183