android.view.ViewGroup#invalidate ( )源码实例Demo

下面列出了android.view.ViewGroup#invalidate ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: star-zone-android   文件: DotWidget.java
private void addDot(View target) {
    ViewGroup.LayoutParams targetViewParams = target.getLayoutParams();
    ViewGroup.LayoutParams newTargetViewParams = new ViewGroup.LayoutParams(targetViewParams.width, targetViewParams.height);
    targetViewParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    targetViewParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    //new一个容器
    container = new FrameLayout(getContext());
    container.setClipToPadding(false);

    ViewGroup parent = (ViewGroup) target.getParent();
    int index = parent.indexOfChild(target);
    //去掉目标view
    parent.removeView(target);
    //添加容器
    parent.addView(container, index, targetViewParams);

    //容器添加目标view
    container.addView(target, newTargetViewParams);
    setVisibility(GONE);
    //容器添加本view(红点)
    container.addView(this);
    parent.invalidate();
}
 
private void triggerViewsReady(final ArrayMap<String, View> sharedElements) {
    if (mAreViewsReady) {
        return;
    }
    mAreViewsReady = true;
    final ViewGroup decor = getDecor();
    // Ensure the views have been laid out before capturing the views -- we need the epicenter.
    if (decor == null || (decor.isAttachedToWindow() &&
            (sharedElements.isEmpty() || !sharedElements.valueAt(0).isLayoutRequested()))) {
        viewsReady(sharedElements);
    } else {
        mViewsReadyListener = OneShotPreDrawListener.add(decor, () -> {
            mViewsReadyListener = null;
            viewsReady(sharedElements);
        });
        decor.invalidate();
    }
}
 
源代码3 项目: MiBandDecompiled   文件: BadgeView.java
private void a(View view)
{
    android.view.ViewGroup.LayoutParams layoutparams = view.getLayoutParams();
    android.view.ViewParent viewparent = view.getParent();
    FrameLayout framelayout = new FrameLayout(i);
    if (view instanceof TabWidget)
    {
        View view1 = ((TabWidget)view).getChildTabViewAt(q);
        j = view1;
        ((ViewGroup)view1).addView(framelayout, new android.view.ViewGroup.LayoutParams(-1, -1));
        setVisibility(8);
        framelayout.addView(this);
        return;
    } else
    {
        ViewGroup viewgroup = (ViewGroup)viewparent;
        int i1 = viewgroup.indexOfChild(view);
        viewgroup.removeView(view);
        viewgroup.addView(framelayout, i1, layoutparams);
        framelayout.addView(view);
        setVisibility(8);
        framelayout.addView(this);
        viewgroup.invalidate();
        return;
    }
}
 
private void startExitTransition() {
    Transition transition = getExitTransition();
    ViewGroup decorView = getDecor();
    if (transition != null && decorView != null && mTransitioningViews != null) {
        setTransitioningViewsVisiblity(View.VISIBLE, false);
        TransitionManager.beginDelayedTransition(decorView, transition);
        setTransitioningViewsVisiblity(View.INVISIBLE, false);
        decorView.invalidate();
    } else {
        transitionStarted();
    }
}
 
源代码5 项目: letv   文件: BottomRedPointView.java
private void applyTo(View target) {
    LayoutParams lp = target.getLayoutParams();
    ViewParent parent = target.getParent();
    FrameLayout container = new FrameLayout(this.context);
    ViewGroup group = (ViewGroup) parent;
    int index = group.indexOfChild(target);
    group.removeView(target);
    group.addView(container, index, lp);
    container.addView(target);
    container.addView(this);
    group.invalidate();
}
 
源代码6 项目: BoardView   文件: BoardAdapter.java
public void removeColumn(int index){
    BoardItem item = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(index);
    ViewGroup group = ((ViewGroup) item.getParent());
    ((ViewGroup)item.getParent()).removeView(item);
    columns.remove(index);
    group.invalidate();
}
 
源代码7 项目: FamilyChat   文件: ParallaxTransformer.java
private void bringViewToFront(View view) {
    ViewGroup group = (ViewGroup) view.getParent();
    int index = group.indexOfChild(view);
    if (index != group.getChildCount() - 1) {
        view.bringToFront();
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
            view.requestLayout();
            group.invalidate();
        }
    }
}
 
源代码8 项目: umeng_community_android   文件: BadgeView.java
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {
            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container,
                    new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);
        } else {
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }
 
源代码9 项目: android-project-wo2b   文件: BadgeView.java
private void applyTo(View target)
{

	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);

	if (target instanceof TabWidget)
	{

		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;

		((ViewGroup) target).addView(container,
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

		this.setVisibility(View.GONE);
		container.addView(this);

	}
	else
	{

		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent;
		int index = group.indexOfChild(target);

		group.removeView(target);
		group.addView(container, index, lp);

		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);

		group.invalidate();

	}

}
 
源代码10 项目: FloatingView   文件: TrashView.java
/**
 * Clear the animation garbage of the target view.
 */
private static void clearClippedChildren(ViewGroup viewGroup) {
    viewGroup.setClipChildren(true);
    viewGroup.invalidate();
    viewGroup.setClipChildren(false);
}
 
源代码11 项目: RefreshActionItem-Native   文件: BadgeView.java
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
源代码12 项目: RefreshActionItem   文件: BadgeView.java
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
源代码13 项目: tysq-android   文件: BadgeView.java
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {

            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container,
                    new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);

        } else {

            // TODO verify that parent is indeed a ViewGroup
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }
 
源代码14 项目: xmpp   文件: BadgeView.java
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
源代码15 项目: aptoide-client   文件: BadgeView.java
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container,
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent;
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
源代码16 项目: RefreshActionItem-Native   文件: BadgeView.java
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
源代码17 项目: BigApp_Discuz_Android   文件: BadgeView.java
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
源代码18 项目: RefreshActionItem   文件: BadgeView.java
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
源代码19 项目: android-common-utils   文件: BadgeView.java
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
源代码20 项目: android-discourse   文件: BadgeView.java
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {

            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);

        } else {

            // TODO verify that parent is indeed a ViewGroup
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }
 
 方法所在类