来自 Cursor 的数据使用 SimpleCursorAdapter 添加到 ListView 显示白色文本(如何使其变为黑色) - 参见图像
这是简单的光标适配器代码
public void displayWords(Cursor c){
// Creates a new SimpleCursorAdapter
SimpleCursorAdapter mCursorAdapter = new SimpleCursorAdapter(
getApplicationContext(), // The application's Context object
android.R.layout.simple_list_item_1, // A layout in XML for one row in the ListView
c, // The result from the query
new String[] {DatabaseTable.COL_WORD}, // A string array of column names in the cursor
new int[] { android.R.id.text1 }); // An integer array of view IDs in the row layout
// Sets the adapter for the ListView
setListAdapter(mCursorAdapter);
/* Using SimpleCursorAdapter to get Data from DB.
* stackoverflow.com/questions/12077955/android-using-simplecursoradapter-to-get-data-from-database-to-listview
*/
}
以及 AndroidManifes 文件中使用的样式资源
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
</style>