List of usage examples for android.view ViewGroup removeView
@Override public void removeView(View view)
Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method.
From source file:bottombar.BottomBarBadge.java
private void wrapTabAndBadgeInSameContainer(final BottomBarTab tab) { ViewGroup tabContainer = (ViewGroup) tab.getParent(); tabContainer.removeView(tab); final BadgeContainer badgeContainer = new BadgeContainer(getContext()); badgeContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); badgeContainer.addView(tab);/* ww w .j av a 2 s. co m*/ badgeContainer.addView(this); tabContainer.addView(badgeContainer, tab.getIndexInTabContainer()); badgeContainer.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @SuppressWarnings("deprecation") @Override public void onGlobalLayout() { badgeContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this); adjustPositionAndSize(tab); } }); }
From source file:com.dianxun.holyn.lucky.view.fragment.BaseFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (rootView != null) { ViewGroup parent = (ViewGroup) rootView.getParent(); if (null != parent) { parent.removeView(rootView); }//from ww w.j a v a2 s . c o m return rootView; } rootView = inflater.inflate(getFragmentLayout(), container, false); return rootView; }
From source file:com.barcamppenang2013.tabfragment.MapFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // View v = inflater.inflate(R.layout.info_page, container, false); // return v;/*from w w w . j a v a 2 s . co m*/ if (view != null) { ViewGroup parent = (ViewGroup) view.getParent(); if (parent != null) parent.removeView(view); } try { view = inflater.inflate(R.layout.map_layout, container, false); mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); Marker marker = mMap .addMarker(new MarkerOptions().position(QUEENSBAY).title("Click Me!").snippet("How To Go")); mMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() { public void onInfoWindowClick(Marker marker) { if (getActivity() == null) return; MainActivity fca = (MainActivity) getActivity(); fca.switchContent(new IndoorMapFragment()); // Intent intent = new Intent(); // intent.setAction(Intent.ACTION_VIEW); // Uri hacked_uri = Uri.parse("file://" + Uri.parse("android.resource://com.barcamppenang2013/"+R.drawable.ic_launcher).getPath()); // Log.d("ddw", "file://" + Uri.parse("android.resource://com.barcamppenang2013/"+R.drawable.ic_launcher).getPath()); // intent.setDataAndType(hacked_uri,"image/png"); // ((MainActivity)getActivity()).startActivity(intent); } }); marker.showInfoWindow(); mMap.getUiSettings().setZoomControlsEnabled(false); CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(5.339027, 100.3066)) // Sets the center // of the map to // Mountain View .zoom(12) // Sets the zoom .build(); // Creates a CameraPosition from the builder mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } catch (InflateException e) { /* map is already there, just return view as it is */ } return view; }
From source file:com.duy.pascal.ui.common.adapter.ViewPagerAdapter.java
/** * Remove a page for the given position. * * @param container The containing View from which the page will be removed. * @param position The page position to be removed. * @param view The same object that was returned by instantiateItem(View, int). *//*from w ww. j ava 2 s. c om*/ @Override public void destroyItem(ViewGroup container, int position, Object view) { if (mCurrentPrimaryItem == view) mCurrentPrimaryItem = null; container.removeView((View) view); }
From source file:com.tcl.lzhang1.mymusic.ui.apdater.MyPageAdapter.java
@Override public void destroyItem(ViewGroup container, int position, Object object) { // TODO Auto-generated method stub // super.destroyItem(container, position, object); container.removeView(mViews.get(position)); }
From source file:transponders.transmob.TutorialFragment.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.finish_tut_button: SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity()); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean(NearbyStops.TUTORIAL_SETTING, false); // Commit the edits! editor.commit();// w w w. ja va2 s .c o m ViewGroup vg = (ViewGroup) (pagerView.getParent()); vg.removeView(pagerView); break; case R.id.next_arrow: pagerView.setCurrentItem(mPageNumber + 1, true); break; case R.id.previous_arrow: pagerView.setCurrentItem(mPageNumber - 1, true); break; } }
From source file:com.pedrogomez.renderers.VPRendererAdapter.java
/** * Remove a view for the given position. The adapter is responsible * for removing the view from its container. * * @param container The containing View from which the view will be removed. * @param position The view position to be removed. * @param object The same object that was returned by * {@link #instantiateItem(ViewGroup, int)}. *///from ww w. j a v a 2 s . com @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); }
From source file:com.sunrun.sunrunframwork.adapter.ImagePagerAdapter.java
@Override public final void destroyItem(ViewGroup container, int position, Object object) { View view = (View) object; container.removeView(view); }
From source file:com.andremion.heroes.ui.section.view.SectionPagerAdapter.java
@Override public void destroyItem(ViewGroup container, int position, Object object) { View view = ((PageItemSectionBinding) object).getRoot(); container.removeView(view); }
From source file:com.lixiang.weather.ui.selectimg.PreViewPagerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (rootView == null) { Bundle bundle = getArguments();//from w w w .j ava2s .c o m path = bundle.getString(PATH); source = bundle.getInt(SOURCE); rootView = inflater.inflate(R.layout.pager_preview, container, false); imageView = (SubsamplingScaleImageView) rootView.findViewById(R.id.imageView); progress_wheel = (ProgressWheel) rootView.findViewById(R.id.progress_wheel); // imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP); // imageView.setDoubleTapZoomScale(2f); if (savedInstanceState != null) { if (path == null && savedInstanceState.containsKey(BUNDLE_ASSET)) { path = savedInstanceState.getString(BUNDLE_ASSET); } } if (path != null) { InitHelper.getImageLoader().loadeImage( source == PreviewPagerActivity.FILE ? ("file://" + path) : path, new ImageLoaderListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { imageView.setImage(ImageSource.bitmap(loadedImage)); progress_wheel.setVisibility(View.GONE); } }); } } else { ViewGroup parent = (ViewGroup) rootView.getParent(); if (parent != null) { parent.removeView(rootView); } } return rootView; }