本文整理匯總了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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}