本文整理汇总了Java中android.view.View.DragShadowBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java View.DragShadowBuilder方法的具体用法?Java View.DragShadowBuilder怎么用?Java View.DragShadowBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.DragShadowBuilder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: startDrag
import android.view.View; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public final void startDrag(View.DragShadowBuilder dragShadowBuilder) {
Point shadowSize = new Point();
Point shadowTouchPoint = new Point();
dragShadowBuilder.onProvideShadowMetrics(shadowSize, shadowTouchPoint);
itemView.startDrag(null, dragShadowBuilder,
new DragInfo(getItemId(), shadowSize, shadowTouchPoint, adapter.getLastTouchPoint()), 0);
adapter.notifyItemChanged(getAdapterPosition());
}
示例4: startDrag
import android.view.View; //导入方法依赖的package包/类
public boolean startDrag() {
if (mDragPotential==null) return false;
AppLauncher dragitem = (AppLauncher) mDragPotential.getTag();
String label = dragitem.getLabel();
ClipData data = ClipData.newPlainText(label, label);
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(mDragPotential);
boolean dragstarted;
if (Build.VERSION.SDK_INT>=24) {
dragstarted = mDragPotential.startDragAndDrop(data, shadowBuilder, mDragPotential, 0);
} else {
dragstarted = mDragPotential.startDrag(data, shadowBuilder, mDragPotential, 0);
}
if (dragstarted) {
mBeingDragged = dragitem;
mDragDropSource = (ViewGroup) mDragPotential.getParent();
Log.d(TAG, "Drag started: " + dragitem.getActivityName() + ", source = " + mDragDropSource);
showHiddenCategories();
// Log.d(TAG, "source = " + mDragDropSource);
//if (mDragDropSource.getId()!=R.id.icontarget) {
showRemoveDropzone();
//}
return true;
}
return false;
}
示例5: startDrag
import android.view.View; //导入方法依赖的package包/类
/**
* Start a drag motion.
*
* @param source source
* @param shadow shadow
* @param data data
*/
public void startDrag(View source, View.DragShadowBuilder shadow, Object data) {
ClipData clipData = ClipData.newPlainText(data.getClass().getName(), "");
DragData dragData = new DragData(source, data);
int token = clipData.getDescription().hashCode();
mDraggedItems.put(token, dragData);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
DragStarterPostNougatImpl.startDrag(source, clipData, shadow, token, 0);
} else {
DragStarterPreNougatImpl.startDrag(source, clipData, shadow, token, 0);
}
}
示例6: getShadowBuilder
import android.view.View; //导入方法依赖的package包/类
public View.DragShadowBuilder getShadowBuilder(View itemView, Point touchPoint) {
return new DragSortShadowBuilder(itemView, touchPoint);
}
示例7: getShadowBuilder
import android.view.View; //导入方法依赖的package包/类
@Override public View.DragShadowBuilder getShadowBuilder(View itemView, Point touchPoint) {
return new NoForegroundShadowBuilder(itemView, touchPoint);
}
示例8: 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);
}
示例9: 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);
}
示例10: 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.startDragAndDrop(clipData, shadow, token, i);
}