當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。