本文整理了Java中android.widget.ImageView.getLocationOnScreen()
方法的一些代码示例,展示了ImageView.getLocationOnScreen()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getLocationOnScreen()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getLocationOnScreen
暂无
代码示例来源:origin: ZieIony/Carbon
public Point getLocationOnScreen() {
int[] outLocation = new int[2];
super.getLocationOnScreen(outLocation);
return new Point(outLocation[0], outLocation[1]);
}
代码示例来源:origin: JingYeoh/FragmentRigger
imageView.getLocationOnScreen(imgViewScreenLoc);
代码示例来源:origin: florent37/ViewAnimator
public void onSvgPath(View view) {
final int[] imgLoc = new int[2];
//save location
imageView4svg.getLocationOnScreen(imgLoc);
ViewAnimator.animate(imageView4svg)
.path(SvgPathParser.tryParsePath(SVG_PATH))
.repeatMode(ViewAnimator.REVERSE)
.repeatCount(2)
.duration(15000)
.onStop(new AnimationListener.Stop() {
@Override
public void onStop() {
//restore location
ViewCompat.setX(imageView4svg, imgLoc[0]);
ViewCompat.setY(imageView4svg, imgLoc[1]);
}
})
.start();
}
代码示例来源:origin: brianwernick/ExoMedia
protected int getHorizontalDelta(View selectedView) {
int[] position = new int[2];
selectedView.getLocationOnScreen(position);
int viewX = position[0];
rippleIndicator.getLocationOnScreen(position);
int newRippleX = viewX - ((rippleIndicator.getWidth() - selectedView.getWidth()) / 2);
return newRippleX - position[0];
}
}
代码示例来源:origin: githubwing/DragPhotoView
public void startPhotoActivity(Context context, ImageView imageView) {
Intent intent = new Intent(context, DragPhotoActivity.class);
int location[] = new int[2];
imageView.getLocationOnScreen(location);
intent.putExtra("left", location[0]);
intent.putExtra("top", location[1]);
intent.putExtra("height", imageView.getHeight());
intent.putExtra("width", imageView.getWidth());
context.startActivity(intent);
overridePendingTransition(0,0);
}
}
代码示例来源:origin: iielse/ImageWatcher
originRef.getLocationOnScreen(location);
imageView.setTranslationX(location[0]);
int locationYOfFullScreen = location[1];
代码示例来源:origin: wobiancao/StickyDemo
public int getDistanceY() {
int[] location = new int[2];
mImageView.getLocationOnScreen(location);
int y = location[1];
return y;
}
代码示例来源:origin: wobiancao/StickyDemo
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
int[] location = new int[2];
mImageView.getLocationOnScreen(location);
int y = location[1];
imageY = y;
}
代码示例来源:origin: stackoverflow.com
private int[] getFrameOfImageView(ImageView imageView) {
int array[] = new int[2];
imageView.getLocationOnScreen(array);
int frame[] = new int[4];
frame[0] = array[0]; // left
frame[1] = array[1]; // top
frame[2] = array[0] + imageView.getWidth(); // right
frame[3] = array[1] + imageView.getHeight(); // bottom
return frame;
}
代码示例来源:origin: pro100svitlo/LockPattern
@Override
public void run() {
calculateItemSize();
for (int i = 0; i < mMatrixSize; i++) {
int[] loc = new int[2];
mAllDots.get(i).getLocationOnScreen(loc);
mDotsCoordinatesX[i] = loc[0] + mDotWidth / 2;
mDotsCoordinatesY[i] = loc[1] + mDotHeight / 2;
Log.d("TAG", "x = " + String.valueOf(mDotsCoordinatesX[i])+"\ny = " +String.valueOf(mDotsCoordinatesY[i]));
}
if (mDotsCoordinatesX[0] == 0) {
calculateDotsCoordinates();
} else {
setDefaultView();
}
}
}, 500);
代码示例来源:origin: whyalwaysmea/BigBoom
private void prepareScene() {
int[] screenLocation = new int[2];
mAuthorAvatar.getLocationOnScreen(screenLocation);
//移动到起始view位置
mDeltaX = mLeft - screenLocation[0];
mDeltaY = mTop - screenLocation[1];
mAuthorAvatar.setTranslationX(mDeltaX);
mAuthorAvatar.setTranslationY(mDeltaY);
}
代码示例来源:origin: derry/delion
/**
* @return The left offset for the suggestion type icon that aligns it with the url bar.
*/
private int getSuggestionIconLeftPosition() {
if (mNavigationButton == null) return 0;
// Ensure the suggestion icon matches the location of the navigation icon in the omnibox
// perfectly.
mNavigationButton.getLocationOnScreen(mViewPositionHolder);
int navButtonXPosition = mViewPositionHolder[0] + mNavigationButton.getPaddingLeft();
getLocationOnScreen(mViewPositionHolder);
return navButtonXPosition - mViewPositionHolder[0];
}
代码示例来源:origin: MrWangChong/DragPhotoView
public static void startImageActivity(Activity activity, ImageView[] imageViews, String[] imageUrls, int currentPosition) {
Intent intent = new Intent(activity, ImageShowActivity.class);
// ImageBean[] imageBeans = new ImageBean[imageViews.length];
ArrayList<ImageBean> imageBeans = new ArrayList<>();
for (ImageView imageView : imageViews) {
ImageBean imageBean = new ImageBean();
int location[] = new int[2];
imageView.getLocationOnScreen(location);
imageBean.left = location[0];
imageBean.top = location[1];
imageBean.width = imageView.getWidth();
imageBean.height = imageView.getHeight();
// imageBeans[i] = imageBean;
imageBeans.add(imageBean);
}
intent.putParcelableArrayListExtra("imageBeans", imageBeans);
intent.putExtra("currentPosition", currentPosition);
intent.putExtra("imageUrls", imageUrls);
activity.startActivity(intent);
activity.overridePendingTransition(0, 0);
}
代码示例来源:origin: githubliruiyuan/Animation
private void pageThreeInit(){
pageThreeAnimationListener = new PageThreeAnimationListener();
page_three_center_hand = (ImageView) view3.findViewById(R.id.page_three_center_hand);
page_three_redpkg1 = (ImageView) view3.findViewById(R.id.page_three_redpkg1);
page_three_redpkg2 = (ImageView) view3.findViewById(R.id.page_three_redpkg2);
page_three_redpkg3 = (ImageView) view3.findViewById(R.id.page_three_redpkg3);
page_three_text = (ImageView) view3.findViewById(R.id.page_three_text);
page_three_go = (ImageView) view3.findViewById(R.id.page_three_go);
animationGo = AnimationUtils.loadAnimation(this, R.anim.tutorail_alpha_common);
animationGo.setAnimationListener(pageThreeAnimationListener);
animationRedP1 = AnimationUtils.loadAnimation(this, R.anim.tutorail_rotate_redp1);
animationRedP2 = AnimationUtils.loadAnimation(this, R.anim.tutorail_alpha_redp2);
animationCenterHand = AnimationUtils.loadAnimation(this, R.anim.tutorail_rotate_hand);
int[] location = new int[2];
DensityUtil densityUtil = new DensityUtil(this);
page_three_text.getLocationOnScreen(location);
float fromXDelta = location[0];
float toYDelta = location[1];
animationText3 = new TranslateAnimation(fromXDelta,fromXDelta,densityUtil.getScreenHeight(),toYDelta);
animationText3.setDuration(1000);
animationText3.setFillAfter(true);
animationText3.setAnimationListener(pageThreeAnimationListener);
}
代码示例来源:origin: stackoverflow.com
ImageView myimage = (ImageView)findViewById(R.id.myimage);
Animation animation = new TranslateAnimation(100, 200, 300, 400);
animation.setDuration(1000);
myimage.startAnimation(animation);
animation.setRepeatCount(Animation.INFINITE);
int[] firstPosition = new int[2];
myimage.measure(View.MeasureSpec.EXACTLY, View.MeasureSpec.EXACTLY);
myimage.getLocationOnScreen(firstPosition);
int r = myimage.getMeasuredWidth() + firstPosition[1];
int rr = myimage.getMeasuredWidth() + firstPosition[0];
代码示例来源:origin: albert-lii/ImageViewer
@Override
public void onItemClick(int position, ImageView view) {
int[] location = new int[2];
// 获取在整个屏幕内的绝对坐标
view.getLocationOnScreen(location);
mViewList.get(position).setTargetX(location[0]);
imageViewer.setStartPosition(position);
imageViewer.setViewData(mViewList);
imageViewer.watch();
}
});
代码示例来源:origin: albert-lii/ImageViewer
@Override
public void onItemClick(int position, ImageView view) {
int[] location = new int[2];
// 获取在整个屏幕内的绝对坐标
view.getLocationOnScreen(location);
// 去掉状态栏的高度
mViewList.get(position).setTargetY(location[1] - mStatusBarHeight);
imageViewer.setStartPosition(position);
imageViewer.setViewData(mViewList);
imageViewer.watch();
}
});
代码示例来源:origin: andforce/iBeebo
private void animateClose(ImageView avatar, Rect ori) {
if (ori == null) {
return;
}
int[] avatarLocation = new int[2];
avatar.getLocationOnScreen(avatarLocation);
final int transX = ori.left - avatarLocation[0];
final int transY = ori.top - avatarLocation[1];
final float scaleX = (float) ori.width() / (float) avatar.getWidth();
final float scaleY = (float) ori.height() / (float) avatar.getHeight();
avatar.animate().translationX(transX).translationY(transY).scaleY(scaleY).scaleX(scaleX).alpha(0.7f).rotationY(0f)
.setDuration(300)
.setListener(new MyAnimationListener(new Runnable() {
@Override
public void run() {
dismissAllowingStateLoss();
}
}));
}
}
代码示例来源:origin: andforce/iBeebo
@Override
public void onGlobalLayout() {
content.getViewTreeObserver().removeGlobalOnLayoutListener(this);// .removeOnGlobalLayoutListener(this);
if (ori == null) {
return;
}
int[] avatarLocation = new int[2];
avatar.getLocationOnScreen(avatarLocation);
final int transX = ori.left - avatarLocation[0];
final int transY = ori.top - avatarLocation[1];
final float scaleX = (float) ori.width() / (float) avatar.getWidth();
final float scaleY = (float) ori.height() / (float) avatar.getHeight();
avatar.setTranslationX(transX);
avatar.setTranslationY(transY);
avatar.setPivotX(0);
avatar.setPivotY(0);
avatar.setScaleX(scaleX);
avatar.setScaleY(scaleY);
avatar.animate().translationX(0).translationY(0).scaleY(1).scaleX(1).alpha(1.0f).setDuration(300);
}
});
代码示例来源:origin: goweii/AnyLayer
@Override
public boolean onPreDraw() {
mViewHolder.getBackground().getViewTreeObserver().removeOnPreDrawListener(this);
Bitmap snapshot = Utils.snapshot(mRootView);
int[] locationRootView = new int[2];
mRootView.getLocationOnScreen(locationRootView);
int[] locationBackground = new int[2];
mViewHolder.getBackground().getLocationOnScreen(locationBackground);
int x = locationBackground[0] - locationRootView[0];
int y = locationBackground[1] - locationRootView[1];
Bitmap original = Bitmap.createBitmap(snapshot, x, y, mViewHolder.getBackground().getWidth(), mViewHolder.getBackground().getHeight());
snapshot.recycle();
Bitmap blur = BlurUtils.blur(mContext, original, mBackgroundBlurRadius, mBackgroundBlurScale);
original.recycle();
mViewHolder.getBackground().setScaleType(ImageView.ScaleType.CENTER_CROP);
mViewHolder.getBackground().setImageBitmap(blur);
mViewHolder.getBackground().setColorFilter(mBackgroundColor);
return true;
}
});
内容来源于网络,如有侵权,请联系作者删除!