(@+id/panel)リストビューがあり、SQLite データベースから取得した条件に基づいてビューの色を変更したいと考えています。
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
     <LinearLayout
         android:layout_width="10dp"
         android:layout_height="fill_parent"
         android:layout_weight="0.01"
         android:orientation="vertical" >
       <View
        android:id="@+id/panel"
        android:layout_width="10dip"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:background="#ffa500"
        android:layout_marginRight="4dip"
        />
   </LinearLayout>
   <LinearLayout
        android:layout_width="0dip"
        android:layout_height="fill_parent"
        android:layout_weight="2.86"
        android:orientation="vertical" >
         <TextView
             android:id="@+id/textViewB"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="" />
     </LinearLayout>
</LinearLayout>
私はそれを行うために SimpleCursorAdapter.ViewBinder を使用しています:
SimpleCursorAdapter.ViewBinder binder = new SimpleCursorAdapter.ViewBinder() {
@Override
public boolean setViewValue(View view, Cursor cursor, int columnIndex){    
    if (view.getId() == R.id.panel) 
    {                               
        String name = cursor.getString(1);
        if (name.equals("Ravi")) {
            view.setBackgroundColor(Color.RED);
        } else {
            view.setBackgroundColor(Color.BLUE);
        }
        return true;
    } 
    return false;
}               
listView.setAdapter(dataAdapter);
dataAdapter.setViewBinder(binder);
このコードはまだ機能しません。コードが条件を通過することはありません。TextView オブジェクトのフォントの色を変更できます(@+id/textViewB)が、ビューの色を変更できませんでした。
ご回答有難うございます。