本文整理了Java中android.widget.ImageView.setOnTouchListener()
方法的一些代码示例,展示了ImageView.setOnTouchListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setOnTouchListener()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:setOnTouchListener
暂无
代码示例来源:origin: north2016/T-MVP
@Override
public void onBindViewHolder(final ItemViewHolder holder, int position) {
holder.textView.setText(mItems.get(position));
holder.handleView.setOnTouchListener((v, event) -> {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN)
mItemTouchHelper.startDrag(holder);
return false;
});
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
/**
* 小窗口
**/
@Override
protected void setSmallVideoTextureView() {
if (mProgressBar != null) {
mProgressBar.setOnTouchListener(null);
mProgressBar.setVisibility(INVISIBLE);
}
if (mFullscreenButton != null) {
mFullscreenButton.setOnTouchListener(null);
mFullscreenButton.setVisibility(INVISIBLE);
}
if (mCurrentTimeTextView != null) {
mCurrentTimeTextView.setVisibility(INVISIBLE);
}
if (mTextureViewContainer != null) {
mTextureViewContainer.setOnClickListener(null);
}
if (mSmallClose != null) {
mSmallClose.setVisibility(VISIBLE);
mSmallClose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
hideSmallVideo();
releaseVideos();
}
});
}
}
代码示例来源:origin: smuyyh/BookReader
public LoginPopupWindow(Activity activity) {
mActivity = activity;
setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mContentView = LayoutInflater.from(activity).inflate(R.layout.layout_login_popup_window, null);
setContentView(mContentView);
qq = (ImageView) mContentView.findViewById(R.id.ivQQ);
weibo = (ImageView) mContentView.findViewById(R.id.ivWeibo);
wechat = (ImageView) mContentView.findViewById(R.id.ivWechat);
qq.setOnTouchListener(this);
weibo.setOnTouchListener(this);
wechat.setOnTouchListener(this);
setFocusable(true);
setOutsideTouchable(true);
setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00000000")));
setAnimationStyle(R.style.LoginPopup);
setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
lighton();
}
});
}
代码示例来源:origin: chrisbanes/PhotoView
public PhotoViewAttacher(ImageView imageView) {
mImageView = imageView;
imageView.setOnTouchListener(this);
imageView.addOnLayoutChangeListener(this);
if (imageView.isInEditMode()) {
代码示例来源:origin: wangdan/AisenWeiBo
public PhotoViewGestureAttacher(ImageView imageView) {
mImageView = new WeakReference<ImageView>(imageView);
imageView.setOnTouchListener(this);
mViewTreeObserver = imageView.getViewTreeObserver();
mViewTreeObserver.addOnGlobalLayoutListener(this);
// Make sure we using MATRIX Scale Type
setImageViewScaleTypeMatrix(imageView);
if (!imageView.isInEditMode()) {
// Create Gesture Detectors...
mScaleDragDetector = VersionedGestureDetector.newInstance(imageView.getContext(), this);
mGestureDetector =
new GestureDetector(imageView.getContext(), new GestureDetector.SimpleOnGestureListener() {
// forward long click listener
public void onLongPress(MotionEvent e) {
if (null != mLongClickListener) {
mLongClickListener.onLongClick(mImageView.get());
}
}
});
mGestureDetector.setOnDoubleTapListener(this);
// Finally, update the UI so that we're zoomable
setZoomable(true);
}
}
代码示例来源:origin: jiangqqlmj/FastDev4Android
public PhotoViewAttacher(ImageView imageView) {
mImageView = new WeakReference<ImageView>(imageView);
imageView.setOnTouchListener(this);
mViewTreeObserver = imageView.getViewTreeObserver();
mViewTreeObserver.addOnGlobalLayoutListener(this);
// Make sure we using MATRIX Scale Type
setImageViewScaleTypeMatrix(imageView);
if (!imageView.isInEditMode()) {
// Create Gesture Detectors...
mScaleDragDetector = VersionedGestureDetector.newInstance(
imageView.getContext(), this);
mGestureDetector = new GestureDetector(imageView.getContext(),
new GestureDetector.SimpleOnGestureListener() {
// forward long click listener
@Override
public void onLongPress(MotionEvent e) {
if (null != mLongClickListener) {
mLongClickListener.onLongClick(mImageView.get());
}
}
});
mGestureDetector.setOnDoubleTapListener(this);
// Finally, update the UI so that we're zoomable
setZoomable(true);
}
}
代码示例来源:origin: TeamNewPipe/NewPipe
});
itemThumbnailView.setOnTouchListener(getOnTouchListener(item));
itemHandleView.setOnTouchListener(getOnTouchListener(item));
代码示例来源:origin: TeamNewPipe/NewPipe
public void buildStreamInfoItem(final PlayQueueItemHolder holder, final PlayQueueItem item) {
if (!TextUtils.isEmpty(item.getTitle())) holder.itemVideoTitleView.setText(item.getTitle());
holder.itemAdditionalDetailsView.setText(Localization.concatenateStrings(item.getUploader(),
NewPipe.getNameOfService(item.getServiceId())));
if (item.getDuration() > 0) {
holder.itemDurationView.setText(Localization.getDurationString(item.getDuration()));
} else {
holder.itemDurationView.setVisibility(View.GONE);
}
ImageLoader.getInstance().displayImage(item.getThumbnailUrl(), holder.itemThumbnailView,
ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS);
holder.itemRoot.setOnClickListener(view -> {
if (onItemClickListener != null) {
onItemClickListener.selected(item, view);
}
});
holder.itemRoot.setOnLongClickListener(view -> {
if (onItemClickListener != null) {
onItemClickListener.held(item, view);
return true;
}
return false;
});
holder.itemThumbnailView.setOnTouchListener(getOnTouchListener(holder));
holder.itemHandle.setOnTouchListener(getOnTouchListener(holder));
}
代码示例来源:origin: TeamNewPipe/NewPipe
@SuppressLint("ClickableViewAccessibility")
void bind(int position, TabViewHolder holder) {
handle.setOnTouchListener(getOnTouchListener(holder));
final Tab tab = tabList.get(position);
final Tab.Type type = Tab.typeFrom(tab.getTabId());
if (type == null) {
return;
}
String tabName = tab.getTabName(requireContext());
switch (type) {
case BLANK:
tabName = requireContext().getString(R.string.blank_page_summary);
break;
case KIOSK:
tabName = NewPipe.getNameOfService(((Tab.KioskTab) tab).getKioskServiceId()) + "/" + tabName;
break;
case CHANNEL:
tabName = NewPipe.getNameOfService(((Tab.ChannelTab) tab).getChannelServiceId()) + "/" + tabName;
break;
}
tabNameView.setText(tabName);
tabIconView.setImageResource(tab.getTabIconRes(requireContext()));
}
代码示例来源:origin: iMeiji/Toutiao
jcVideo.thumbImageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
代码示例来源:origin: CarGuo/GSYVideoPlayer
mFullscreenButton.setOnTouchListener(this);
代码示例来源:origin: multidots/android-app-common-tasks
/**
* use for apply pinchzoom functionality to your imageview
*
* @param mImageView on which you have to apply pinchzoom functionality
*/
public static void applyPinchZoomImage(ImageView mImageView) {
mImageView.setOnTouchListener(new PinchZoom());
}
代码示例来源:origin: multidots/android-app-common-tasks
/**
* use for apply pinchzoom functionality to your imageview
*
* @param mImageView on which you have to apply pinchzoom functionality
*/
public static void applyPinchZoomImage(ImageView mImageView) {
mImageView.setOnTouchListener(new PinchZoom());
}
代码示例来源:origin: DaxiaK/MyDiary
private void initView() {
if (isEditMode) {
IV_memo_item_dot.setImageResource(R.drawable.ic_memo_swap_vert_black_24dp);
ViewGroup.LayoutParams layoutParams = IV_memo_item_dot.getLayoutParams();
layoutParams.width = layoutParams.height = ScreenHelper.dpToPixel(mActivity.getResources(), 24);
IV_memo_item_delete.setVisibility(View.VISIBLE);
IV_memo_item_dot.setOnTouchListener(this);
IV_memo_item_delete.setOnClickListener(this);
RL_memo_item_root_view.setOnClickListener(this);
} else {
IV_memo_item_dot.setImageResource(R.drawable.ic_memo_dot_24dp);
ViewGroup.LayoutParams layoutParams = IV_memo_item_dot.getLayoutParams();
layoutParams.width = layoutParams.height = ScreenHelper.dpToPixel(mActivity.getResources(), 10);
IV_memo_item_delete.setVisibility(View.GONE);
IV_memo_item_dot.setOnTouchListener(null);
IV_memo_item_delete.setOnClickListener(null);
RL_memo_item_root_view.setOnClickListener(this);
}
}
代码示例来源:origin: pili-engineering/PLDroidShortVideo
public FrameSelectorView(Context context, AttributeSet attrs) {
super(context, attrs);
View view = LayoutInflater.from(context).inflate(R.layout.frame_selector_view, this);
mHandlerLeft = (ImageView) view.findViewById(R.id.handler_left);
mHandlerRight = (ImageView) view.findViewById(R.id.handler_right);
mHandlerBody = view.findViewById(R.id.handler_body);
mHandlerLeft.setOnTouchListener(new HandlerLeftTouchListener());
mHandlerRight.setOnTouchListener(new HandlerRightTouchListener());
mHandlerBody.setOnTouchListener(new HandlerBodyTouchListener());
post(new Runnable() {
@Override
public void run() {
mGroupLayoutParam = (FrameLayout.LayoutParams) getLayoutParams();
}
});
}
代码示例来源:origin: multidots/android-app-common-tasks
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_color_picker);
ivColorImage = (ImageView) findViewById(R.id.imageView);
ivColorImage.setOnTouchListener(onTouchListener);
findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Common.pickImage(ColorPickerActivity.this, 123);
}
});
}
代码示例来源:origin: fossasia/pslab-android
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_pin_layout, container, false);
ImageView imgLayout = view.findViewById(R.id.img_pslab_pin_layout);
colorMap = view.findViewById(R.id.img_pslab_color_map);
imgLayout.setImageDrawable(ResourcesCompat.getDrawable(getResources(),
frontSide ? R.drawable.pslab_v5_front_layout : R.drawable.pslab_v5_back_layout, null));
colorMap.setImageDrawable(ResourcesCompat.getDrawable(getResources(),
frontSide ? R.drawable.pslab_v5_front_colormap : R.drawable.pslab_v5_back_colormap, null));
imgLayout.setOnTouchListener(this);
populatePinDetails();
return view;
}
代码示例来源:origin: JasonQS/Anti-recall
adjuster.setY(App.adjusterY - App.adjusterOriginalY);
adjuster.setOnTouchListener(new View.OnTouchListener() {
float difAdjuster = 0;
float downY = 0;
代码示例来源:origin: multidots/android-app-common-tasks
private void sharedConstructing(Context context) {
super.setClickable(true);
this.context = context;
mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
mGestureDetector = new GestureDetector(context, new GestureListener());
matrix = new Matrix();
prevMatrix = new Matrix();
m = new float[9];
normalizedScale = 1;
if (mScaleType == null) {
mScaleType = ScaleType.FIT_CENTER;
}
minScale = 1;
maxScale = 3;
superMinScale = SUPER_MIN_MULTIPLIER * minScale;
superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
setImageMatrix(matrix);
setScaleType(ScaleType.MATRIX);
setState(State.NONE);
onDrawReady = false;
super.setOnTouchListener(new PrivateOnTouchListener());
}
代码示例来源:origin: multidots/android-app-common-tasks
private void sharedConstructing(Context context) {
super.setClickable(true);
this.context = context;
mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
mGestureDetector = new GestureDetector(context, new GestureListener());
matrix = new Matrix();
prevMatrix = new Matrix();
m = new float[9];
normalizedScale = 1;
if (mScaleType == null) {
mScaleType = ScaleType.FIT_CENTER;
}
minScale = 1;
maxScale = 3;
superMinScale = SUPER_MIN_MULTIPLIER * minScale;
superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
setImageMatrix(matrix);
setScaleType(ScaleType.MATRIX);
setState(State.NONE);
onDrawReady = false;
super.setOnTouchListener(new PrivateOnTouchListener());
}
内容来源于网络,如有侵权,请联系作者删除!