本文整理汇总了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);
}
}
}