<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants" >
<Button android:id="@+id/item_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:focusable="false" android:clickable="true" android:text="删除"/>
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, final int position,long id) {
//item点击事件 比如修改店名
}
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
//删除数据的方法
});
shop_lv.setOnItemLongClickListener(new itemLongClick());
class itemLongClick implements OnItemLongClickListener{
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Log.e("OnItemLongClickListener","long clikc");
return true;
}
}
原文:http://www.cnblogs.com/superdo/p/5137815.html