代替グループヘッダーの2つの色を無効なリストビューに設定しました。しかし、何回かクリックすると、色がどのグループ行にも拡大/縮小されます。ここで拡張可能なリストビューグループのヘッダーカラーの変更
これは、リストをスクロールした後に起こっている
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_group, null);
if(groupPosition % 2 == 1) {
convertView.setBackgroundColor(Color.parseColor("#3C3C3C"));
}else {
convertView.setBackgroundColor(Color.parseColor("#000000"));
}
}
、私のコードです。 =
if (groupPosition % 2 == 0)
{
convertView.setBackgroundColor(Color.parseColor("#3C3C3C"));
}
else
{
convertView.setBackgroundColor(Color.parseColor("#000000"));
}
。色は変わりますが、色を変えた後、色はどの行にも移動します。 –
最初のチェック:if(convertView == null){ \t \t \t convertView = inflater.inflate(R.layout.listrow_group、null); \t \t}次に、If条件の外にコードを設定します。私のコードで –
:: IF(convertView == NULL){ LayoutInflater infalInflater =(LayoutInflater)this._context \t \t \t \t \t .getSystemService(Context.LAYOUT_INFLATER_SERVICE)。 \t \t \t convertView = infalInflater.inflate(R.layout.list_item、NULL); \t \t} –