本文整理匯總了Java中android.view.View.OnDragListener方法的典型用法代碼示例。如果您正苦於以下問題:Java View.OnDragListener方法的具體用法?Java View.OnDragListener怎麽用?Java View.OnDragListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.View
的用法示例。
在下文中一共展示了View.OnDragListener方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setOnDragListener
import android.view.View; //導入方法依賴的package包/類
@Override
public void setOnDragListener(final View.OnDragListener dragListener) {
View.OnDragListener wrapper = new OnDragListener() {
@Override
public boolean onDrag(View view, DragEvent dragEvent) {
int action = dragEvent.getAction();
// Whether the dragged object can be handled by the trash.
boolean result = dragListener.onDrag(view, dragEvent);
if (action == DragEvent.ACTION_DRAG_ENDED) {
setState(STATE_DEFAULT);
} else if (result) {
switch (action) {
case DragEvent.ACTION_DRAG_ENTERED:
setState(STATE_ON_HOVER);
break;
case DragEvent.ACTION_DROP:
case DragEvent.ACTION_DRAG_EXITED:
setState(STATE_DEFAULT);
break;
}
}
return result;
}
};
super.setOnDragListener(wrapper);
}
示例2: QuickRow
import android.view.View; //導入方法依賴的package包/類
public QuickRow(final View.OnDragListener dragListener, MainActivity mainActivity) {
mMainActivity = mainActivity;
mQuickRow = mMainActivity.findViewById(R.id.layout_quickrow);
mQuickRowScroller = mMainActivity.findViewById(R.id.layout_quickrow_scroll);
mQuickRow.setOnDragListener(dragListener);
mQuickRowScroller.setOnDragListener(new View.OnDragListener() {
@Override
public boolean onDrag(View view, DragEvent dragEvent) {
return dragListener.onDrag(mQuickRow, dragEvent);
}
});
}
示例3: getDragEventListener
import android.view.View; //導入方法依賴的package包/類
/**
* @return The listener to use for {@link DragEvent}'s in the {@link WorkspaceView}.
*/
public View.OnDragListener getDragEventListener() {
return mDragEventListener;
}
示例4: initiliazeInternalListener
import android.view.View; //導入方法依賴的package包/類
private void initiliazeInternalListener() {
mInternalDragListener = new View.OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) {
case DragEvent.ACTION_DRAG_STARTED:
// check if listener could catch this event.
ClipDescription description = event.getClipDescription();
if (description == null) {
return false;
}
String className = String.valueOf(description.getLabel());
if (mDraggedItem == null && mHandledClassNames.contains(className)) {
// retrieve the data object linked to the dragged event.
mDraggedItem = DragHelper.getDraggedItem(((Integer) event.getLocalState()));
onDragStarted(mDraggedItem.getSource(), mDraggedItem.getData());
return true;
} else {
return false;
}
case DragEvent.ACTION_DRAG_ENTERED:
onDragEntered(mDraggedItem.getSource(), mDraggedItem.getData());
break;
case DragEvent.ACTION_DRAG_LOCATION:
onDragLocation(
mDraggedItem.getSource(), mDraggedItem.getData(),
event.getX(), event.getY()
);
break;
case DragEvent.ACTION_DROP:
onDragDropped(
mDraggedItem.getSource(), mDraggedItem.getData(),
event.getX(), event.getY()
);
break;
case DragEvent.ACTION_DRAG_EXITED:
onDragExited(mDraggedItem.getSource(), mDraggedItem.getData());
break;
case DragEvent.ACTION_DRAG_ENDED:
if (mDraggedItem != null) {
onDragEnded(mDraggedItem.getSource(), mDraggedItem.getData());
DragHelper.clearDraggedItem(mDraggedItem.getToken());
mDraggedItem = null;
}
break;
default:
break;
}
return true;
}
};
}
示例5: getInternalDragListener
import android.view.View; //導入方法依賴的package包/類
/**
* Retrieve the internal drag listener.
*
* @return internal drag listener.
*/
View.OnDragListener getInternalDragListener() {
return mInternalDragListener;
}
示例6: setOnDragListener
import android.view.View; //導入方法依賴的package包/類
/**
* Delegiert von android.widget.Button
*
* @param l siehe {@link Button}
*/
public void setOnDragListener(View.OnDragListener l) {
b.setOnDragListener(l);
}