android listView 中存在editView chetxBox等点击事件处理
2010-05-24 16:32:00 来源:WEB开发网* Implement your click behavior here
* @param v The clicked view.
*/
public abstract void onClick(View v, ViewHolder viewHolder);
};
/**
* The long click listener base class.
*/
public static abstract class OnLongClickListener implements
View.OnLongClickListener {
private ViewHolder mViewHolder;
/**
* @param holder The holder of the clickable item
*/
public OnLongClickListener(ViewHolder holder) {
mViewHolder = holder;
}
// delegates the click event
public boolean onLongClick(View v) {
onLongClick(v, mViewHolder);
return true;
}
/**
* Implement your click behavior here
* @param v The clicked view.
*/
public abstract void onLongClick(View v, ViewHolder viewHolder);
};
/**
* @param context The current context
* @param viewid The resource id of your list view item
* @param objects The object list, or null, if you like to indicate an empty
* list
*/
public ClickableListAdapter(Context context, int viewid, List objects) {
// Cache the LayoutInflate to avoid asking for a new one each time.
mInflater = LayoutInflater.from(context);
mDataObjects = objects;
mViewId = viewid;
if (objects == null) {
mDataObjects = new ArrayList
/**
* The number of objects in the list.
*/
public int getCount() {
return mDataObjects.size();
}
/**
* @return We simply return the object at position of our object list Note,
* the holder object uses a back reference to its related data
* object. So, the user usually should use {@link ViewHolder#data}
更多精彩
赞助商链接