本文整理汇总了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);
}