本文整理了Java中android.widget.ImageView.getParent()
方法的一些代码示例,展示了ImageView.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getParent()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getParent
暂无
代码示例来源:origin: bingoogolapple/BGABanner-Android
public void removePlaceholder() {
if (mPlaceholderIv != null && this.equals(mPlaceholderIv.getParent())) {
removeView(mPlaceholderIv);
mPlaceholderIv = null;
}
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@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;
}
代码示例来源:origin: chrisbanes/PhotoView
ViewParent parent = mImageView.getParent();
if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling() && !mBlockParentIntercept) {
if (mHorizontalScrollEdge == HORIZONTAL_EDGE_BOTH
代码示例来源:origin: Bearded-Hen/Android-Bootstrap
@Override
public void run() {
Rect bounds = new Rect();
closeButton.getHitRect(bounds);
bounds.top -= DimenUtils.dpToPixels(6);
bounds.bottom += DimenUtils.dpToPixels(6);
bounds.left -= DimenUtils.dpToPixels(6);
bounds.right += DimenUtils.dpToPixels(6);
TouchDelegate touchDelegate = new TouchDelegate(bounds, closeButton);
if (View.class.isInstance(closeButton.getParent())) {
((View) closeButton.getParent()).setTouchDelegate(touchDelegate);
}
}
});
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if (splashImageView.getParent() != null) {
((ViewGroup) splashImageView.getParent()).removeView(splashImageView);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if (splashImageView.getParent() != null) {
((ViewGroup) splashImageView.getParent()).removeView(splashImageView);
代码示例来源:origin: Ramotion/garland-view-android
mFooter = itemView.findViewById(R.id.header_footer);
mMiddleCollapsible.add((View)mAvatar.getParent());
mMiddleCollapsible.add((View)mName.getParent());
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Called by the Android system each time the Activity is destroyed or recreated.
* For jME, we clear references to the GLSurfaceView.
*/
@Override
public void onDestroyView() {
logger.fine("onDestroyView");
if (splashImageView != null && splashImageView.getParent() != null) {
((ViewGroup) splashImageView.getParent()).removeView(splashImageView);
}
if (view.getParent() != null) {
((ViewGroup) view.getParent()).removeView(view);
}
if (frameLayout != null && frameLayout.getParent() != null) {
((ViewGroup) frameLayout.getParent()).removeView(frameLayout);
}
view.removeOnLayoutChangeListener(this);
splashImageView = null;
frameLayout = null;
view = null;
JmeAndroidSystem.setView(null);
super.onDestroyView();
}
代码示例来源:origin: wangdan/AisenWeiBo
public final void onDrag(float dx, float dy) {
if (DEBUG) {
Log.d(LOG_TAG, String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy));
}
ImageView imageView = getImageView();
if (null != imageView && hasDrawable(imageView)) {
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).
*/
if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) {
if (mScrollEdge == EDGE_BOTH || (mScrollEdge == EDGE_LEFT && dx >= 1f)
|| (mScrollEdge == EDGE_RIGHT && dx <= -1f)) {
imageView.getParent().requestDisallowInterceptTouchEvent(false);
}
}
}
}
代码示例来源:origin: jiangqqlmj/FastDev4Android
public final void onDrag(float dx, float dy) {
if (DEBUG) {
Log.d(LOG_TAG, String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy));
}
ImageView imageView = getImageView();
if (null != imageView && hasDrawable(imageView)) {
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).
*/
if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling()) {
if (mScrollEdge == EDGE_BOTH
|| (mScrollEdge == EDGE_LEFT && dx >= 1f)
|| (mScrollEdge == EDGE_RIGHT && dx <= -1f)) {
imageView.getParent().requestDisallowInterceptTouchEvent(
false);
}
}
}
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
if (holder.imageView.getParent() != null) {
ViewGroup viewGroup = (ViewGroup) holder.imageView.getParent();
viewGroup.removeView(holder.imageView);
代码示例来源:origin: CarGuo/GSYVideoPlayer
imageView.setImageResource(R.mipmap.xxx2);
if (imageView.getParent() != null) {
ViewGroup viewGroup = (ViewGroup) imageView.getParent();
viewGroup.removeView(imageView);
代码示例来源:origin: Bearded-Hen/Android-Bootstrap
((View) closeButton.getParent()).post(new Runnable() {
@Override
public void run() {
代码示例来源:origin: TeamNewPipe/NewPipe
public void onPlayBackgroundButtonClicked() {
if (DEBUG) Log.d(TAG, "onPlayBackgroundButtonClicked() called");
if (playerImpl.getPlayer() == null) return;
setRecovery();
final Intent intent = NavigationHelper.getPlayerIntent(
context,
BackgroundPlayer.class,
this.getPlayQueue(),
this.getRepeatMode(),
this.getPlaybackSpeed(),
this.getPlaybackPitch(),
this.getPlaybackSkipSilence(),
this.getPlaybackQuality()
);
context.startService(intent);
((View) getControlAnimationView().getParent()).setVisibility(View.GONE);
destroy();
finish();
}
代码示例来源:origin: TeamNewPipe/NewPipe
@Override
public void onFullScreenButtonClicked() {
super.onFullScreenButtonClicked();
if (DEBUG) Log.d(TAG, "onFullScreenButtonClicked() called");
if (simpleExoPlayer == null) return;
if (!PermissionHelper.isPopupEnabled(context)) {
PermissionHelper.showPopupEnablementToast(context);
return;
}
setRecovery();
final Intent intent = NavigationHelper.getPlayerIntent(
context,
PopupVideoPlayer.class,
this.getPlayQueue(),
this.getRepeatMode(),
this.getPlaybackSpeed(),
this.getPlaybackPitch(),
this.getPlaybackSkipSilence(),
this.getPlaybackQuality()
);
context.startService(intent);
((View) getControlAnimationView().getParent()).setVisibility(View.GONE);
destroy();
finish();
}
代码示例来源:origin: iielse/ImageWatcher
/**
* 更新ViewPager中每项的当前状态,比如是否加载,比如是否加载失败
*
* @param position 当前项的位置
* @param loading 是否显示加载中
* @param error 是否显示加载失败
*/
void notifyItemChangedState(int position, boolean loading, boolean error) {
ImageView imageView = mImageSparseArray.get(position);
if (imageView != null) {
FrameLayout itemView = (FrameLayout) imageView.getParent();
View loadView = itemView.getChildAt(1);
if (loadingUIProvider != null) {
if (loading) loadingUIProvider.start(loadView);
else loadingUIProvider.stop(loadView);
}
ImageView errorView = (ImageView) itemView.getChildAt(2);
errorView.setAlpha(1f);
errorView.setVisibility(error ? View.VISIBLE : View.GONE);
}
}
代码示例来源:origin: iielse/ImageWatcher
/**
* 处理结束下拉退出的手指事件,进行退出图片查看或者恢复到初始状态的收尾动画<br>
* 还需要还原背景色
*/
private void handleExitTouchResult() {
if (iSource == null) return;
if (mExitRef > 0.75f) {
ViewState vsExit = ViewState.read(iSource, ViewState.STATE_EXIT);
if (vsExit != null) animSourceViewStateTransform(iSource, vsExit);
animBackgroundTransform(0xFF000000, 0);
} else {
ViewState vsOrigin = ViewState.read(iSource, ViewState.STATE_ORIGIN);
if (vsOrigin != null) {
if (vsOrigin.alpha == 0) {
vsOrigin.translationX(iSource.getTranslationX()).translationY(iSource.getTranslationY());
}
animSourceViewStateTransform(iSource, vsOrigin);
}
animBackgroundTransform(0x00000000, STATE_EXIT_HIDING);
((FrameLayout) iSource.getParent()).getChildAt(2).animate().alpha(0).start();
}
}
代码示例来源:origin: dibakarece/DMAudioStreamer
private static void progressEvent(View v, boolean isShowing) {
try {
View parent = (View) ((ImageView) v).getParent();
ProgressBar pg = (ProgressBar) parent.findViewById(R.id.pg);
if (pg != null)
pg.setVisibility(isShowing ? View.GONE : View.VISIBLE);
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: caichengan/ShoppingCartActivity
@Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView view = list.get(position);
ViewParent vp = view.getParent();
if (vp != null) {
ViewGroup parent = (ViewGroup) vp;
parent.removeView(view);
}
((ViewPager) container).addView(list.get(position));
return list.get(position);
}
代码示例来源:origin: ymback/NGA-CLIENT-VER-OPEN-SOURCE
private void updateToolbarLayout() {
if (!mConfig.isFullScreenMode()) {
int statusBarHeight = getStatusBarHeight();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) toolbar.getLayoutParams();
lp.setMargins(0, statusBarHeight, 0, 0);
View parentView = (View) mAvatarIv.getParent();
parentView.setPadding(0, statusBarHeight, 0, 0);
}
}
内容来源于网络,如有侵权,请联系作者删除!