本文整理匯總了Java中android.view.View.startDrag方法的典型用法代碼示例。如果您正苦於以下問題:Java View.startDrag方法的具體用法?Java View.startDrag怎麽用?Java View.startDrag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.View
的用法示例。
在下文中一共展示了View.startDrag方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onLongClick
import android.view.View; //導入方法依賴的package包/類
@Override
public boolean onLongClick(View v) {
ClipData.Item item = new ClipData.Item("" + v.getTag());
ClipData dragData = new ClipData("" + v.getTag(), new String[] {ClipDescription.MIMETYPE_TEXT_PLAIN},item);
View.DragShadowBuilder myShadow = new MyDragShadowBuilder(v);
showDragBuide();
v.startDrag(dragData, // the data to be dragged
myShadow, // the drag shadow builder
null, // no need to use local data
0 // flags (not currently used, set to 0)
);
v.setAlpha(0.2f);
return true;
}
示例2: startDrag
import android.view.View; //導入方法依賴的package包/類
/**
* 開始拖拽
*
* @param v 當前對象
*/
private void startDrag(View v) {
// 選項內容
String optionContent = ((Button) v).getText().toString();
// 記錄當前答案選項的位置
optionPosition = getOptionPosition(optionContent);
// 開始拖拽後在列表中隱藏答案選項
v.setVisibility(INVISIBLE);
ClipData.Item item = new ClipData.Item(optionContent);
ClipData data = new ClipData(null, new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN}, item);
v.startDrag(data, new DragShadowBuilder(v), null, 0);
}
示例3: onLongClick
import android.view.View; //導入方法依賴的package包/類
@Override
public boolean onLongClick(View v) {
ClipData data = ClipData.newPlainText("simple_text", "text");
View.DragShadowBuilder sb = new View.DragShadowBuilder(v);
v.startDrag(data, sb, v, 0);
v.setVisibility(View.INVISIBLE);
return (true);
}
示例4: onLongClick
import android.view.View; //導入方法依賴的package包/類
@Override
public boolean onLongClick(View v) {
ClipData data = ClipData.newPlainText("simple_text", "text");
View.DragShadowBuilder sb = new View.DragShadowBuilder(v);
v.startDrag(data, sb, v, 0);
v.setVisibility(View.INVISIBLE);
return (true);
}
示例5: startDrag
import android.view.View; //導入方法依賴的package包/類
/**
* Used to start a drag on the given view.
*
* @param source view from which the drag motion is started.
* @param clipData data linked to the drag motion.
* @param shadow shadow displayed during the drag.
* @param token token.
* @param i flags.
*/
public static void startDrag(View source, ClipData clipData, View.DragShadowBuilder shadow, int token, int i) {
source.startDrag(clipData, shadow, token, i);
}