私は次のリストビューを持っています:
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1" >
</ListView>
最初の n 番目の列の背景色を更新したい。
そのために私は使用しています:
int numOfMessages=lst.length-lstNew.length;
ArrayAdapter<String> adpt = new ArrayAdapter<String>(Messages.this, android.R.layout.simple_list_item_1,lst);
lm.setAdapter(adpt);
for (int i=1;i<numOfMessages;i++)
{
tv.setText("Welcome " + i);
lm.getChildAt(i).setBackgroundColor(Color.BLUE);
tv.setText("Welcome : " + i);
}
しかし、次の行に何か問題があります。
lm.getChildAt(i).setBackgroundColor(Color.BLUE);
その後、コントロールはそれ以上動かないからです。
テキストビューの背景色を動的に変更するのを手伝ってください。