スクロール機能を使用して、データベースのコンテンツの一部をユーザーに表示したいと考えています。
そこで、ListActivity を拡張し、SimpleCursorAdapter を使用しました。問題は、変位した値が見えないことです。
private void fillData() {
// Get all of the rows from the database and create the item list
ListData = data.findAllDbValues();
startManagingCursor(ListData);
// Create an array to specify the fields we want to display in the list
String[] from = new String[]{Data.ID, Data.DESC};
// and an array of the fields we want to bind those fields to
int[] to = new int[]{R.id.text1, R.id.text2};
// Now create a simple cursor adapter and set it to display
ListAdapter la = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_2, ListData, from, to);//R.layout.showdata
setListAdapter(la);
}
TextView が 2 つしかないカスタム レイアウト (R.layout.showdata) を使用すると、値を確認できますが、選択範囲のどこかに触れるのではなく、表示されているテキストに触れて仕事をする必要があります。
だから私は simple_list_item_2 を使いたいので、この能力を持つことができます。値が表示されない理由や、カスタム レイアウトを作成して simple_list と同じ機能を生成するにはどうすればよいですか?