사용자 지정 CursorAdapter가있는 ListView가 있습니다. CursorAdapter의 매개 변수 사이에는 테마가 있고, CursorAdapter는 전달 된 테마의 색상을 설정합니다.사용자 지정 어댑터의 매개 변수 변경
private MyCustomAdapter mAdapter;
public void onCreate(Bundle savedInstanceState) {
ListView lv = (ListView)findViewById(R.id.myList);
mAdapter = new MyCustomAdapter(
this,
R.layout.my_list_row,
null, // cursor set later by cursorloader
mTheme); //int selected theme
lv.setAdapter(mAdapter);
}
사용자 테마가 변경된 경우 실제로 나는 새로운 MyCustomAdapter를 생성, 위의 코드를 repete이 경우, 확인() onResume에서, 선호도에서 테마를 변경할 수 있습니다.
제 질문은 : 기존 매개 변수를 사용하여 하나의 매개 변수를 변경하고 업데이트 할 수 있습니까? 커서 변화가 내가
mAdapter.swapCursor(cursor);
캔트는 색상/스타일을 다루는 CursorAdapter (http://developer.android.com/reference/android/widget/CursorAdapter.html)에서 메소드 또는 생성자를 찾습니다. 어떻게 커서 어댑터에 테마를 전달합니까? – HighFlyer
particolar 테마를 적용하는 데 사용되는 int 값을 전달하기 위해 어댑터 용 사용자 지정 생성자를 작성합니다. – crbin1