1. <CheckBox
  2. android:id="@+id/cb"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. android:focusable="false"
  6. android:focusableInTouchMode="false"
  7. android:clickable="false"
  8. android:checkMark="?android:attr/listChoiceIndicatorMultiple"/>
  1. android:focusable="false"
  2. android:focusableInTouchMode="false"
  3. android:clickable="false"






在看4.2.2apidemos中的代码时,在中看到如下代码rn[code=java] /**rn * Make a view to hold each row.rn *rn * @see android.widget.ListAdapter#getView(int, android.view.View,rn * android.view.ViewGroup)rn */rn public View getView(int position, View convertView, ViewGroup parent) rn // A ViewHolder keeps references to children views to avoid unneccessary callsrn // to findViewById() on each row.rn ViewHolder holder;rnrn // When convertView is not null, we can reuse it directly, there is no needrn // to reinflate it. We only inflate a new View when the convertView suppliedrn // by ListView is null.rn if (convertView == null) rn convertView = mInflater.inflate(R.layout.list_item_icon_text, null);rnrn // Creates a ViewHolder and store references to the two children viewsrn // we want to bind data to.rn holder = new ViewHolder();rn holder.text = (TextView) convertView.findViewById(;rn holder.icon = (ImageView) convertView.findViewById(;rnrn convertView.setTag(holder);rn else rn // Get the ViewHolder back to get fast access to the TextViewrn // and the ImageView.rn holder = (ViewHolder) convertView.getTag();rn rnrn // Bind the data efficiently with the holder.rn holder.text.setText(DATA[position]);rn holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 : mIcon2);rnrn return convertView;rn rnrn static class ViewHolder rn TextView text;rn ImageView icon;rn [/code]rn想到有个问题是:如果我想单独给TextView写个OnClick方法,应该怎么取得这个View的实例呢?BaseAdapter中有什么方法能实现吗?rn或者我能直接取得包裹text和icon的LinearLayout实例吗?这个实例在Activity中应该是个ListItem。 论坛