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

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

源代码1 项目: YCAudioPlayer   文件: WebViewActivity.java
@Override
protected void onDestroy() {
    if (mWebView != null) {
        mWebView.clearHistory();
        ViewGroup parent = (ViewGroup) mWebView.getParent();
        if (parent != null) {
            parent.removeView(mWebView);
        }
        mWebView.destroy();
        mWebView = null;
    }
    super.onDestroy();
    if (jsAppInterface != null) {
        jsAppInterface.unregister();
    }
}
 
源代码2 项目: AdPlayBanner   文件: ImageLoaderManager.java
/**
 * 从container中移除已经添加过的view
 * @param container  父布局
 * @param object     不需要用的view
 */
public void destroyPageView(ViewGroup container, Object object) {
    switch (mImageLoaderType) {
        default:
        case FRESCO:
            SimpleDraweeView mFrescoView = (SimpleDraweeView) object;
            container.removeView(mFrescoView);
            mViewCaches.add(mFrescoView);
            break;

        case GLIDE:
            ImageView mGlideView = (ImageView) object;
            container.removeView(mGlideView);
            mViewCaches.add(mGlideView);
            break;

        case PICASSO:
            ImageView mPicassoView = (ImageView) object;
            container.removeView(mPicassoView);
            mViewCaches.add(mPicassoView);
            break;
    }
}
 
源代码3 项目: QSVideoPlayer   文件: QSVideoView.java
@Override
public void quitWindowFullscreen() {
    if (currentMode == MODE_WINDOW_FULLSCREEN & checkSpaceOK()) {
        if (full_flag)
            Util.SET_FULL(getContext());
        else
            Util.CLEAR_FULL(getContext());
        if (orientation_flag)
            Util.SET_PORTRAIT(getContext());
        else
            Util.SET_LANDSCAPE(getContext());

        Util.showNavigationBar(getContext(), true);

        ViewGroup vp = (ViewGroup) videoView.getParent();
        if (vp != null)
            vp.removeView(videoView);
        addView(videoView, new LayoutParams(-1, -1));
        setStateAndMode(currentState, MODE_WINDOW_NORMAL);
    }
}
 
源代码4 项目: TigerVideo   文件: VideoPlayerView.java
/**
 * 全屏与非全屏切换
 *
 * 全屏播放实现逻辑:
 * 1.将当前VideoPlayerView从父容器中移除
 * 2.然后再将当前VideoPlayerView添加到当前Activity的顶级容器Window.ID_ANDROID_CONTENT中
 * 3.设置当前Activity为全屏状态
 * 4.设置横屏
 *
 * 步骤1和2保证了所有的播放操作均为同一对象,不存在播放状态的变化,因而可以有效的避免播放状态导致的异常崩溃
 *
 *
 * 开始全屏播放
 *
 * 使用全屏播放功能时一定要在对应的Activity声明中添加配置:
 * android:configChanges="orientation|screenSize|keyboardHidden"
 */
@Override
public void onStartFullScreen() {

    mToggleFullScreen = true;
    setCurrentScreenState(ScreenState.SCREEN_STATE_FULLSCREEN);
    PlayerManager.getInstance().pause();

    ViewGroup windowContent = (ViewGroup) (Utils.getActivity(getContext())).findViewById(Window.ID_ANDROID_CONTENT);
    mVideoWidth = this.getWidth();
    mVideoHeight = this.getHeight();
    mOldParent = (ViewGroup)this.getParent();
    mOldIndex = mOldParent.indexOfChild(this);
    mOldParent.removeView(this);

    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    windowContent.addView(this, lp);

    initFullScreenGestureView();
    Utils.getActivity(getContext()).getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置全屏
    Utils.getActivity(getContext()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    PlayerManager.getInstance().play();
    onToggleFullScreenLockState(false);
}
 
源代码5 项目: zhangshangwuda   文件: BaseMenuPresenter.java
/**
 * Add an item view at the given index.
 *
 * @param itemView View to add
 * @param childIndex Index within the parent to insert at
 */
protected void addItemView(View itemView, int childIndex) {
    final ViewGroup currentParent = (ViewGroup) itemView.getParent();
    if (currentParent != null) {
        currentParent.removeView(itemView);
    }
    ((ViewGroup) mMenuView).addView(itemView, childIndex);
}
 
源代码6 项目: APlayer   文件: FastScrollRecyclerView.java
@Override
protected void onAttachedToWindow() {
  super.onAttachedToWindow();
  mFastScroller.attachRecyclerView(this);

  ViewParent parent = getParent();

  if (parent instanceof ViewGroup) {
    ViewGroup viewGroup = (ViewGroup) parent;
    viewGroup.removeView(mFastScroller);
    viewGroup.addView(mFastScroller);
    mFastScroller.setLayoutParams(viewGroup);
  }
}
 
@Override
protected void onStop() {
    FrameLayout rootView = (FrameLayout) findViewById(R.id.flutter_rootview);
    XFlutterView flutterView = getFlutterView();
    ViewGroup priorParent = (ViewGroup) flutterView.getParent();
    if(isFlutterViewAttachedOnMe())
        eventDelegate.onStop();
    super.onStop();
    if(super.isFinishing()){
        HybridStackManager.sharedInstance().methodChannel.invokeMethod("popRouteNamed",curFlutterRouteName);
        if (priorParent == rootView) {
            priorParent.removeView(flutterView);
        }
    }
}
 
源代码8 项目: ReadMark   文件: BannerPageView.java
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView((View) object);

    if(!mConvertViews.contains((View) object)){
        mConvertViews.add((View) object);
    }
}
 
源代码9 项目: ReadMark   文件: BannerPageView.java
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView((View) object);

    if(!mConvertViews.contains((View) object)){
        mConvertViews.add((View) object);
    }
}
 
源代码10 项目: Mortar-architect   文件: StackablePagerAdapter.java
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    View view = ((View) object);
    MortarScope scope = MortarScope.getScope(view.getContext());
    container.removeView(view);
    scope.destroy();
}
 
源代码11 项目: nano-wallet-android   文件: CurrencyPagerAdapter.java
@Override
public void destroyItem(ViewGroup collection, int position, Object view) {
    collection.removeView((View) view);
}
 
源代码12 项目: PageTransformerHelp   文件: BannerAdapter.java
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView(((ImageView) object));
}
 
源代码13 项目: ArrayPagerAdapter   文件: ArrayViewPagerAdapter.java
@Override
public void destroyItem(ViewGroup container, int position, Object item) {
    container.removeView(findViewWithTagInViewPager(container, item));
}
 
源代码14 项目: delion   文件: ChromeActivity.java
/**
 * This function builds the {@link CompositorViewHolder}.  Subclasses *must* call
 * super.setContentView() before using {@link #getTabModelSelector()} or
 * {@link #getCompositorViewHolder()}.
 */
@Override
protected final void setContentView() {
    final long begin = SystemClock.elapsedRealtime();
    TraceEvent.begin("onCreate->setContentView()");

    enableHardwareAcceleration();
    setLowEndTheme();
    int controlContainerLayoutId = getControlContainerLayoutId();
    WarmupManager warmupManager = WarmupManager.getInstance();
    if (warmupManager.hasBuiltOrClearViewHierarchyWithToolbar(controlContainerLayoutId)) {
        View placeHolderView = new View(this);
        setContentView(placeHolderView);
        ViewGroup contentParent = (ViewGroup) placeHolderView.getParent();
        WarmupManager.getInstance().transferViewHierarchyTo(contentParent);
        contentParent.removeView(placeHolderView);
    } else {
        setContentView(R.layout.main);
        if (controlContainerLayoutId != NO_CONTROL_CONTAINER) {
            ViewStub toolbarContainerStub =
                    ((ViewStub) findViewById(R.id.control_container_stub));
            toolbarContainerStub.setLayoutResource(controlContainerLayoutId);
            toolbarContainerStub.inflate();
        }
    }
    TraceEvent.end("onCreate->setContentView()");
    mInflateInitialLayoutDurationMs = SystemClock.elapsedRealtime() - begin;

    // Set the status bar color to black by default. This is an optimization for
    // Chrome not to draw under status and navigation bars when we use the default
    // black status bar
    ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK);

    ViewGroup rootView = (ViewGroup) getWindow().getDecorView().getRootView();
    mCompositorViewHolder = (CompositorViewHolder) findViewById(R.id.compositor_view_holder);
    mCompositorViewHolder.setRootView(rootView);

    // Setting fitsSystemWindows to false ensures that the root view doesn't consume the insets.
    rootView.setFitsSystemWindows(false);

    // Add a custom view right after the root view that stores the insets to access later.
    // ContentViewCore needs the insets to determine the portion of the screen obscured by
    // non-content displaying things such as the OSK.
    mInsetObserverView = InsetObserverView.create(this);
    rootView.addView(mInsetObserverView, 0);
}
 
源代码15 项目: UltimateAndroid   文件: JazzyViewActivity.java
@Override
public void destroyItem(ViewGroup container, int position, Object obj) {
	container.removeView(mJazzy.findViewFromObject(position));
}
 
源代码16 项目: letv   文件: LiveRemenLivePagerAdapter.java
public void destroyItem(ViewGroup container, int position, Object object) {
    View view = (View) object;
    this.mViews.remove(Integer.valueOf(position));
    container.removeView(view);
}
 
源代码17 项目: UltimateAndroid   文件: QuickContactFragment.java
@Override
public void destroyItem(ViewGroup container, int position, Object view) {
    container.removeView((View) view);
}
 
源代码18 项目: MNImageBrowser   文件: MNImageBrowserActivity.java
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView((View) object);
}
 
源代码19 项目: Android   文件: EmojiPagerAdapter.java
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    View layout = (View) object;
    container.removeView(layout);
}
 
源代码20 项目: VideoMeeting   文件: ImageAdapter.java
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView((View) object);
}
 
 方法所在类