最近、ListAdapter を使用して ListView を作成し、リストの背後に静的な背景画像を適用しました。
String[] teams = getResources().getStringArray(R.array.array);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_view, teams));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setBackgroundResource(R.drawable.football_turf_subtle);
lv.setCacheColorHint(0);
各リスト項目にさまざまな項目を含めるために、SimpleAdapter の使用に切り替えています。
setContentView(R.layout.custom_list_view);
SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.row_view,
new String[] {"pen","price","color"},
new int[] {R.id.text1,R.id.text2, R.id.text3} );
populateList();
setListAdapter(adapter);
参考までに、上記のリストの項目は、私が見つけた例からのものです。私が直面している問題は、以前に ListAdapter バージョンで行ったように、背景画像を適用する方法がわからないことです。(すなわち setBackgroundResource)
どんな助けでも大歓迎です!