Cursor c = wda.getLists();
startManagingCursor(c);
String[] from = new String[] { BaseColumns._ID, wmDbAdapter.KEY_TEXT };
int[] to = new int[] { R.id._id,R.id.text};
mAdapter = new SimpleCursorAdapter(this, R.layout.wm_row, c, from, to);
setListAdapter(mAdapter);
이렇게 해서
<?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"
android:orientation="horizontal" android:background="#ffffff">
<TextView
android:id="@+id/_id"
android:padding="5px"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<TextView
android:id="@+id/seq"
android:padding="5px"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<TextView
android:id="@+id/text"
android:padding="5px"
android:layout_height="wrap_content"
android:layout_width="fill_parent" android:textColor ="#330000"
/>
</LinearLayout>
이렇게 하면 쭉 목록이 나오는데 특정행에 대해서는 폰트크기랑 색을 제어할수 있도록 하려면 어떻게 해야 하나요??
예를 들어서 첫번째 행에 type 칼럼의 값이 A이면 글씨 크기를 15 로 하고 B이면 20으로 하고 이렇게요.
아시분 부탁드립니다.
고맙습니다.
리스트 item에 쓰이는 커스텀 레이아웃...
simpleCursorAdapter에 보면 인터페이스 하나 정의되어있습니다.
ViewBinder 라는 인터페이스인데
이거 하나 정의하고 쓰시면 됩니다.
boolean setViewValue(View view, Cursor cursor, int columnIndex)
이 메소드 달랑 하나 있구요
from to가 매칭된 view와 columindex 그리고 cursor까지 넘어오니까
cursor에서 값 뜯어와서
view를 textView로 캐스팅 하셔서 setColor 혹은 setTextSize 같은거 하시면 되겠네요.
adapter.setViewBinder() 라는 메소드 통해서 ViewBinder 객체 넣어주시면 됩니다.



