如何在android中自定义可扩展列表,我必须在同一行的子视图中设计imageview,textview和imageButton。并单击该imageButton上的事件。如何实现它,任何帮助表示赞赏。
谢谢。
答案 0 :(得分:3)
您可以查看示例here希望这可能对您有帮助..
Google的API演示Expandable ListView
答案 1 :(得分:2)
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
LinearLayout rowView;
Color color = getItem(position);
if (convertView == null)
{
rowView = new LinearLayout(getContext());
LayoutInflater vi =
(LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
vi.inflate(textViewResourceId, rowView, true);
}
else
{
rowView = (LinearLayout) convertView;
}
TextView name = (TextView) rowView.findViewById(R.id.color_name_txt);
CheckBox colorCheckbox = (CheckBox) rowView.findViewById(R.id.color_checkbox);
meaning.setText(color.getName());
colorCheckbox.setChecked(color.isChecked());
return rowView;
}