0
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);
}
我的問題是我怎麼能爲我的按鈕iv設置OnClickListener? 它不允許我在onDrag上設置。 在此先感謝Android:如何設置onClickListener方法聲明組件在開始和停止拖動
你嘗試setonclicklistener? – blessenm 2012-04-25 10:38:55