Java Code Examples for android.view.ViewGroup#removeView()
The following examples show how to use
android.view.ViewGroup#removeView() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebViewActivity.java From YCAudioPlayer with Apache License 2.0 | 6 votes |
@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(); } }
Example 2
Source File: ImageLoaderManager.java From AdPlayBanner with Apache License 2.0 | 6 votes |
/** * 从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; } }
Example 3
Source File: QSVideoView.java From QSVideoPlayer with Apache License 2.0 | 6 votes |
@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); } }
Example 4
Source File: VideoPlayerView.java From TigerVideo with Apache License 2.0 | 6 votes |
/** * 全屏与非全屏切换 * * 全屏播放实现逻辑: * 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); }
Example 5
Source File: BaseMenuPresenter.java From zhangshangwuda with Apache License 2.0 | 5 votes |
/** * 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); }
Example 6
Source File: StackablePagerAdapter.java From Mortar-architect with MIT License | 5 votes |
@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(); }
Example 7
Source File: FastScrollRecyclerView.java From APlayer with GNU General Public License v3.0 | 5 votes |
@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); } }
Example 8
Source File: FlutterWrapperActivity.java From hybrid_stack_manager with MIT License | 5 votes |
@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); } } }
Example 9
Source File: BannerPageView.java From ReadMark with Apache License 2.0 | 5 votes |
@Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); if(!mConvertViews.contains((View) object)){ mConvertViews.add((View) object); } }
Example 10
Source File: BannerPageView.java From ReadMark with Apache License 2.0 | 5 votes |
@Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); if(!mConvertViews.contains((View) object)){ mConvertViews.add((View) object); } }
Example 11
Source File: ImageAdapter.java From VideoMeeting with Apache License 2.0 | 4 votes |
@Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); }
Example 12
Source File: EmojiPagerAdapter.java From Android with MIT License | 4 votes |
@Override public void destroyItem(ViewGroup container, int position, Object object) { View layout = (View) object; container.removeView(layout); }
Example 13
Source File: MNImageBrowserActivity.java From MNImageBrowser with GNU General Public License v3.0 | 4 votes |
@Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); }
Example 14
Source File: QuickContactFragment.java From UltimateAndroid with Apache License 2.0 | 4 votes |
@Override public void destroyItem(ViewGroup container, int position, Object view) { container.removeView((View) view); }
Example 15
Source File: LiveRemenLivePagerAdapter.java From letv with Apache License 2.0 | 4 votes |
public void destroyItem(ViewGroup container, int position, Object object) { View view = (View) object; this.mViews.remove(Integer.valueOf(position)); container.removeView(view); }
Example 16
Source File: JazzyViewActivity.java From UltimateAndroid with Apache License 2.0 | 4 votes |
@Override public void destroyItem(ViewGroup container, int position, Object obj) { container.removeView(mJazzy.findViewFromObject(position)); }
Example 17
Source File: ChromeActivity.java From delion with Apache License 2.0 | 4 votes |
/** * 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); }
Example 18
Source File: ArrayViewPagerAdapter.java From ArrayPagerAdapter with Apache License 2.0 | 4 votes |
@Override public void destroyItem(ViewGroup container, int position, Object item) { container.removeView(findViewWithTagInViewPager(container, item)); }
Example 19
Source File: BannerAdapter.java From PageTransformerHelp with Apache License 2.0 | 4 votes |
@Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(((ImageView) object)); }
Example 20
Source File: CurrencyPagerAdapter.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void destroyItem(ViewGroup collection, int position, Object view) { collection.removeView((View) view); }