I made a sample using this link: http://ericharlow.blogspot.in/2010/10/experience-android-drag-and-drop-list.html.
i am able to drag and drop objects from my list view.
Here is the code for my start and stop drag:
public void onStartDrag(View itemView) {
itemView.setVisibility(View.INVISIBLE);
defaultBackgroundColor = itemView.getDrawingCacheBackgroundColor();
// itemView.setBackgroundColor(backgroundColor);
mChangeButton = (Button) findViewById(R.id.change_btn);
Button iv = (Button) itemView.findViewById(R.id.delete_btn);
if (iv != null)
iv.setVisibility(View.INVISIBLE);
}
@Override
public void onStopDrag(View itemView) {
itemView.setVisibility(View.VISIBLE);
// itemView.setBackgroundColor(defaultBackgroundColor);
mChangeButton = (Button) findViewById(R.id.change_btn);
Button iv = (Button) itemView.findViewById(R.id.delete_btn);
if (iv != null)
iv.setVisibility(View.VISIBLE);
}
我的问题是如何为我的 Button iv 设置 OnClickListener?它不允许我设置 onDrag。提前致谢