2011-04-08 121 views
-2

如何在Android中定制可扩展列表,我必须在同一行的子视图中设计imageview,textview和imageButton。并点击该图像按钮上的事件。如何实现它,任何帮助表示赞赏。自定义可扩展列表

谢谢。

回答

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; 
    }