当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.getParent方法代码示例

本文整理汇总了Java中android.widget.ImageView.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.getParent方法的具体用法?Java ImageView.getParent怎么用?Java ImageView.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.getParent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDrag

import android.widget.ImageView; //导入方法依赖的package包/类
public void onDrag(float dx, float dy) {
    if(!this.mScaleDragDetector.isScaling()) {
        if(DEBUG) {
            LogManager.getLogger().d("PhotoViewAttacher", String.format("onDrag: dx: %.2f. dy: %.2f", new Object[]{Float.valueOf(dx), Float.valueOf(dy)}));
        }

        ImageView imageView = this.getImageView();
        this.mSuppMatrix.postTranslate(dx, dy);
        this.checkAndDisplayMatrix();
        ViewParent parent = imageView.getParent();
        if(this.mAllowParentInterceptOnEdge && !this.mScaleDragDetector.isScaling() && !this.mBlockParentIntercept) {
            if((this.mScrollEdge == 2 || this.mScrollEdge == 0 && dx >= 1.0F || this.mScrollEdge == 1 && dx <= -1.0F) && null != parent) {
                parent.requestDisallowInterceptTouchEvent(false);
            }
        } else if(null != parent) {
            parent.requestDisallowInterceptTouchEvent(true);
        }

    }
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:21,代码来源:PhotoViewAttacher.java

示例2: setImage

import android.widget.ImageView; //导入方法依赖的package包/类
public GravityView setImage(ImageView image, int drawable) {
    image_view = image;
    Bitmap bmp = resizeBitmap(Common.getDeviceHeight(mContext), drawable);
    image_view.setLayoutParams(new HorizontalScrollView.LayoutParams(bmp.getWidth(), bmp.getHeight()));
    image_view.setImageBitmap(bmp);
    mMaxScroll = bmp.getWidth();
    if (image.getParent() instanceof HorizontalScrollView) {
            ((HorizontalScrollView) image.getParent()).setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View view, MotionEvent motionEvent) {
                    return true;
                }
            });
    }
    return gravityView;
}
 
开发者ID:gofynd,项目名称:gravity-view,代码行数:17,代码来源:GravityView.java

示例3: onDrag

import android.widget.ImageView; //导入方法依赖的package包/类
public void onDrag(float dx, float dy) {
    if (!this.mScaleDragDetector.isScaling()) {
        if (DEBUG) {
            LogManager.getLogger().d(LOG_TAG, String.format("onDrag: dx: %.2f. dy: %.2f", new Object[]{Float.valueOf(dx), Float.valueOf(dy)}));
        }
        ImageView imageView = getImageView();
        this.mSuppMatrix.postTranslate(dx, dy);
        checkAndDisplayMatrix();
        ViewParent parent = imageView.getParent();
        if (!this.mAllowParentInterceptOnEdge || this.mScaleDragDetector.isScaling()) {
            if (parent != null) {
                parent.requestDisallowInterceptTouchEvent(true);
            }
        } else if ((this.mScrollEdge == 2 || ((this.mScrollEdge == 0 && dx >= 1.0f) || (this.mScrollEdge == 1 && dx <= -1.0f))) && parent != null) {
            parent.requestDisallowInterceptTouchEvent(false);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:PhotoViewAttacher.java

示例4: instantiateItem

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position)
{

    //对ViewPager页号求模取出View列表中要显示的项
    position %= mList.size();
    if (position < 0)
    {
        position = mList.size() + position;
    }
    ImageView v = mList.get(position);
    pos = position;
    v.setScaleType(ImageView.ScaleType.CENTER);
    //如果View已经在之前添加到了一个父组件,则必须先remove,否则会抛出IllegalStateException。
    ViewParent vp = v.getParent();
    if (vp != null)
    {
        ViewGroup parent = (ViewGroup) vp;
        parent.removeView(v);
    }
    v.setOnClickListener(v1 -> {

        if (mViewPagerOnItemClickListener != null)
        {
            mViewPagerOnItemClickListener.onItemClick();
        }
    });


    container.addView(v);
    return v;
}
 
开发者ID:WeDevelopTeam,项目名称:HeroVideo-master,代码行数:33,代码来源:BannerAdapter.java

示例5: onDrag

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onDrag(float dx, float dy) {
    if (mScaleDragDetector.isScaling()) {
        return; // Do not drag if we are already scaling
    }

    if (DEBUG) {
        LogManager.getLogger().d(LOG_TAG,
                String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy));
    }

    ImageView imageView = getImageView();
    mSuppMatrix.postTranslate(dx, dy);
    checkAndDisplayMatrix();

    /**
     * Here we decide whether to let the ImageView's parent to start taking
     * over the touch event.
     *
     * First we check whether this function is enabled. We never want the
     * parent to take over if we're scaling. We then check the edge we're
     * on, and the direction of the scroll (i.e. if we're pulling against
     * the edge, aka 'overscrolling', let the parent take over).
     */
    ViewParent parent = imageView.getParent();
    if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling() && !mBlockParentIntercept) {
        if (mScrollEdge == EDGE_BOTH
                || (mScrollEdge == EDGE_LEFT && dx >= 1f)
                || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) {
            if (null != parent) {
                parent.requestDisallowInterceptTouchEvent(false);
            }
        }
    } else {
        if (null != parent) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
    }
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:40,代码来源:PhotoViewAttacher.java

示例6: instantiateItem

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {

  //对ViewPager页号求模取出View列表中要显示的项
  position %= mList.size();
  if (position < 0) {
    position = mList.size() + position;
  }
  ImageView v = mList.get(position);
  pos = position;
  v.setScaleType(ImageView.ScaleType.CENTER);
  //如果View已经在之前添加到了一个父组件,则必须先remove,否则会抛出IllegalStateException。
  ViewParent vp = v.getParent();
  if (vp != null) {
    ViewGroup parent = (ViewGroup) vp;
    parent.removeView(v);
  }
  v.setOnClickListener(v1 -> {

    if (mViewPagerOnItemClickListener != null) {
      mViewPagerOnItemClickListener.onItemClick();
    }
  });

  container.addView(v);
  return v;
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:28,代码来源:BannerAdapter.java

示例7: instantiateItem

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
        public Object instantiateItem(ViewGroup container, int position) {
//            position = position % bannerMap.size() == 0 ? bannerMap.size() - 1 : position % bannerMap.size() - 1;
            position %= imgList.size();
            ImageView iv = imgList.get(position);
            ViewParent vp = iv.getParent();
            if (vp != null) {
                ViewGroup parent = (ViewGroup) vp;
                parent.removeView(iv);
            }
            container.addView(iv);
            return iv;
        }
 
开发者ID:wzc25151,项目名称:lrs_android,代码行数:14,代码来源:AutoScrollViewPager.java

示例8: onDrag

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onDrag(float dx, float dy) {
    if (mScaleDragDetector.isScaling()) {
        return; // Do not drag if we are already scaling
    }

    ImageView imageView = getImageView();
    mSuppMatrix.postTranslate(dx, dy);
    checkAndDisplayMatrix();

    /**
     * Here we decide whether to let the ImageView's parent to start taking
     * over the touch event.
     *
     * First we check whether this function is enabled. We never want the
     * parent to take over if we're scaling. We then check the edge we're
     * on, and the direction of the scroll (i.e. if we're pulling against
     * the edge, aka 'overscrolling', let the parent take over).
     */
    ViewParent parent = imageView.getParent();
    if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling() && !mBlockParentIntercept) {
        if (mScrollEdge == EDGE_BOTH
                || (mScrollEdge == EDGE_LEFT && dx >= 1f)
                || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) {
            if (null != parent) {
                parent.requestDisallowInterceptTouchEvent(false);
            }
        }
    } else {
        if (null != parent) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
    }
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:35,代码来源:PhotoViewAttacher.java

示例9: instantiateItem

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position)
{
    //对ViewPager页号求模取出View列表中要显示的项
    position %= mListImgView.size();
    if (position<0){
        position = mListImgView.size()+position;
    }
    final ImageView view = mListImgView.get(position);
    //如果View已经在之前添加到了一个父组件,则必须先remove,否则会抛出IllegalStateException。
    ViewGroup vp = (ViewGroup) view.getParent();
    if (vp!=null)
    {
        vp.removeView(view);
    }
    container.addView(view);
    final int newPosition = position;
    view.setOnClickListener(new OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
            if (mOnSliderItemClickListener != null)
            {
                mOnSliderItemClickListener.onSliderItemClick(newPosition);
            }
        }
    });
    return view;
}
 
开发者ID:z13538657403,项目名称:SliderImageLayout,代码行数:31,代码来源:SliderImageLayout.java

示例10: onDrag

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onDrag(float dx, float dy) {
    if (mScaleDragDetector.isScaling()) {
        return; // Do not drag if we are already scaling
    }

    if (DEBUG) {
        LogManager.getLogger().d(LOG_TAG,
                String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy));
    }

    ImageView imageView = getImageView();
    mSuppMatrix.postTranslate(dx, dy);
    checkAndDisplayMatrix();

    /**
     * Here we decide whether to let the ImageView's parent to start taking
     * over the touch event.
     *
     * First we check whether this function is enabled. We never want the
     * parent to take over if we're scaling. We then check the edge we're
     * on, and the direction of the scroll (i.e. if we're pulling against
     * the edge, aka 'overscrolling', let the parent take over).
     */
    ViewParent parent = imageView.getParent();
    if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) {
        if (mScrollEdge == EDGE_BOTH
                || (mScrollEdge == EDGE_LEFT && dx >= 1f)
                || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) {
            if (null != parent)
                parent.requestDisallowInterceptTouchEvent(false);
        }
    } else {
        if (null != parent) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
    }
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:39,代码来源:PhotoViewAttacher.java

示例11: onDrag

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onDrag(float dx, float dy) {
    if (mScaleDragDetector.isScaling()) {
        return; // Do not drag if we are already scaling
    }

    if (DEBUG) {
        LogManager.getLogger().d(LOG_TAG,
                String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy));
    }

    ImageView imageView = getImageView();
    mSuppMatrix.postTranslate(dx, dy);
    checkAndDisplayMatrix();

    /**
     * Here we decide whether to let the ImageView's parent to start taking
     * over the touch event.
     *
     * First we check whether this function is enabled. We never want the
     * parent to take over if we're scaling. We then check the edge we're
     * on, and the direction of the scroll (i.e. if we're pulling against
     * the edge, aka 'overscrolling', let the parent take over).
     */
    ViewParent parent = imageView.getParent();
    if (mAllowParentInterceptOnEdge) {
        if (mScrollEdge == EDGE_BOTH
                || (mScrollEdge == EDGE_LEFT && dx >= 1f)
                || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) {
            if (null != parent)
                parent.requestDisallowInterceptTouchEvent(false);
        }
    } else {
        if (null != parent) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
    }
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:39,代码来源:PhotoViewAttacher.java

示例12: onDrag

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public final void onDrag(float dx, float dy) {
    if (mScaleDragDetector.isScaling()) {
        return; // Do not drag if we are already scaling
    }

    if (DEBUG) {
        LogManager.getLogger().d(LOG_TAG,
                String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy));
    }

    ImageView imageView = getImageView();
    mSuppMatrix.postTranslate(dx, dy);
    checkAndDisplayMatrix();

    /**
     * Here we decide whether to let the ImageView's parent to start taking
     * over the touch event.
     *
     * First we check whether this function is enabled. We never want the
     * parent to take over if we're scaling. We then check the edge we're
     * on, and the direction of the scroll (i.e. if we're pulling against
     * the edge, aka 'overscrolling', let the parent take over).
     */
    ViewParent parent = imageView.getParent();
    // Modify: 2014年6月21日 18:56:10
    //if (mAllowParentInterceptOnEdge) {
	if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) {
        if (mScrollEdge == EDGE_BOTH
                || (mScrollEdge == EDGE_LEFT && dx >= 1f)
                || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) {
            if (null != parent)
                parent.requestDisallowInterceptTouchEvent(false);
        }
    } else {
        if (null != parent) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
    }
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:41,代码来源:PhotoViewAttacher.java


注:本文中的android.widget.ImageView.getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。