1

解析後に Xml ファイルからデータが取り込まれる Expandable listView があります。私のカスタム アダプター、つまり NewAdapter は、Expandable リストにコンテンツを入力します。私の問題は、タイプが 0 または 1 または 2 のような何かの値に等しい場合、実行時に子行の画像がそれに応じて変更される必要がある行の条件を適用するGetChildView()関数から発生します。グループの最初のクリックで書き込みが変更されましたが、2番目のグループをクリックすると、画像の設定の異常な動作が表示されます。私のコードが続いているように

public View getChildView(int groupPosition, final int childPosition,
   boolean isLastChild, View convertView, ViewGroup parent) 
 {
  tempChild = (ArrayList<String>) Childtem.get(groupPosition);
  Log.d("djdfj", ""+tempChild.size()+"");
  TextView text = null;
  if (convertView == null) 
  {
   convertView = minflater.inflate(R.layout.child_row, null);
  }
  Log.d("check in before if block", ""+sitesList.getResourceType().get(1)+"");
  text = (TextView) convertView.findViewById(R.id.textView1);
  img_mediaType = (ImageView)convertView.findViewById(R.id.childImage1);
  img_status_type =(ImageView)convertView.findViewById(R.id.childImage2);
  text.setText(tempChild.get(childPosition));
  if(childPosition==1 && groupPosition==0)
  {
      if(sitesList.getResourceType().get(5).equals("6"))
      {
          Log.d("check in if block",""+sitesList.getResourceType().get(5).equals("6")+"");
          img_mediaType.setBackgroundResource(R.drawable.images);
          img_status_type.setBackgroundResource(R.drawable.images);
      }
 }

これらは私のスクリーンショットです。これは、グループ 1 とグループ 2 をクリックした後の画面です。これは 2 番目のグループをクリックした後のものです

質問を適切に説明できることを願っていますが、明確ではないかもしれませんが、Expandable ListView で実行時に画像を変更する方法を教えてください

4

0 に答える 0