私はAndroidの初心者です。レイアウトでハードコーディングするのではなく、manin スレッドで指定する必要があるカスタム情報が 1 行にある、拡張可能な ListView を作成したいと考えています。
画像と2つのテキストビューが必要です。カスタム レイアウト ファイルが必要になると思いますが、コード内でそれを呼び出す場所がわかりません。手伝ってください。
以下は、カスタム アダプター内の GropView fxn です。ケース 0 でカスタム レイアウト ファイルを読み込みたい
public View getGroupView(int groupPosition, boolean arg1, View convertView,
ViewGroup arg3) {
String laptopName = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.group_item, null);
}
TextView item = (TextView) convertView.findViewById(R.id.laptop);
item.setTypeface(null, Typeface.BOLD);
item.setText(laptopName);
this.context = (Activity) context;
switch (groupPosition) {
case 0:
convertView.setBackgroundColor(this.context.getResources()
.getColor(R.color.dark_blue));
convertView.inflate(R.layout.first_row_layout, 0, arg3);
break;
case 1:
convertView.setBackgroundColor(this.context.getResources()
.getColor(R.color.purple));
break;
case 2:
convertView.setBackgroundColor(this.context.getResources()
.getColor(R.color.green));
break;
default:
break;
}
return convertView;
}