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:com.philliphsu.bottomsheetpickers.date.PagingMonthAdapter.java
@Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); mMonthYearTitles.delete(position);/*from w w w . ja va 2 s . c om*/ mMonthViews.remove(object); }
From source file:jp.co.rediscovery.firstflight.ConfigPagerAdapter.java
@Override public synchronized void destroyItem(@NonNull final ViewGroup container, final int position, @NonNull final Object object) { if (DEBUG)// w ww. ja v a2s.c o m Log.v(TAG, "destroyItem:position=" + position); if (object instanceof View) { container.removeView((View) object); } }
From source file:com.gao.im.ui.CCPFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (mLayoutListenerView == null) { mLayoutListenerView = inflater.inflate(R.layout.ccp_fragment, null); mCCProotView = (LinearLayout) mLayoutListenerView.findViewById(R.id.ccp_root_view); if (getTitleLayoutId() != -1) { // ???ActionBar?? mCCProotView.addView(inflater.inflate(getTitleLayoutId(), null), LinearLayout.LayoutParams.MATCH_PARENT, DensityUtil.getMetricsDensity(getActivity(), 50.0F)); }/* w w w . ja va 2 s. c o m*/ // ?? if (getLayoutId() != -1) { mContentView = (ViewGroup) inflater.inflate(getLayoutId(), null); mCCProotView.addView(mContentView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); } } ViewGroup mViewRoot = (ViewGroup) mLayoutListenerView.getParent(); if (mViewRoot != null) { mViewRoot.removeView(mLayoutListenerView); } return mLayoutListenerView; }
From source file:com.example.liangmutian.linkscrollmsky.MyActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); toolsRe = (RelativeLayout) findViewById(R.id.toolsre); backRe = (RelativeLayout) findViewById(R.id.backre); overRe = (RelativeLayout) findViewById(R.id.over_re); viewPager = (ViewPager) findViewById(R.id.viewpager); LayoutInflater lf = getLayoutInflater().from(this); view1 = lf.inflate(R.layout.layout1, null); view2 = lf.inflate(R.layout.layout2, null); viewList = new ArrayList<View>(); viewList.add(view1);//from www . ja v a 2 s . c o m viewList.add(view2); listView = (RecyclerView) view1.findViewById(R.id.list); List<String> list = new ArrayList<String>(); for (int i = 0; i < 50; ++i) { list.add(" String " + i); } listView.setAdapter(new StringAdapter(list)); layoutManager = new LinearLayoutManager(this); listView.setLayoutManager(layoutManager); mHandler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); float alpha = ((float) msg.what) / 100f; Log.e("alpha", msg.what + ":" + alpha); overRe.setAlpha(alpha); if (msg.what == 0) { backRe.setVisibility(View.INVISIBLE); toolsRe.setVisibility(View.VISIBLE); } else { backRe.setVisibility(View.VISIBLE); toolsRe.setVisibility(View.INVISIBLE); } } }; pagerAdapter = new PagerAdapter() { @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == arg1; } @Override public int getCount() { return viewList.size(); } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(viewList.get(position)); } @Override public int getItemPosition(Object object) { return super.getItemPosition(object); } @Override public Object instantiateItem(ViewGroup container, int position) { container.addView(viewList.get(position)); return viewList.get(position); } }; viewPager.setAdapter(pagerAdapter); backRe.setPadding(0, 0, 0, DensityUtil.getZhuangtai(this)); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); collapsingToolbar.setBackgroundResource(R.drawable.cheese_2); }
From source file:cc.metapro.openct.customviews.TableChooseDialog.java
private void setView() { mTableIds = new ArrayList<>(tableMap.size()); for (String s : tableMap.keySet()) { mTableIds.add(s);/*from w ww . jav a2 s . co m*/ } final List<View> views = new ArrayList<>(mTableIds.size()); for (String s : mTableIds) { TextView textView = new TextView(getActivity()); String content = tableMap.get(s).toString(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { textView.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_COMPACT)); } else { textView.setText(Html.fromHtml(content)); } views.add(textView); } mTabBar.setupWithViewPager(mViewPager); mViewPager.setAdapter(new PagerAdapter() { @Override public int getCount() { return mTableIds.size(); } @Override public CharSequence getPageTitle(int position) { return mTableIds.get(position); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(views.get(position)); } @Override public Object instantiateItem(ViewGroup container, int position) { container.addView(views.get(position)); return views.get(position); } }); }
From source file:com.andremion.louvre.preview.PreviewAdapter.java
@Override public void destroyItem(ViewGroup container, int position, Object object) { View view = ((ViewHolder) object).itemView; container.removeView(view); }
From source file:com.hippo.widget.viewpager.RecyclerPagerAdapter.java
@Override public void destroyItem(ViewGroup container, int position, Object object) { //noinspection unchecked E holder = (E) object;/* w w w .j a v a 2 s . c o m*/ container.removeView(holder.itemView); unbindPagerHolder(holder, position); holder.oldPosition = INVALID_POSITION; holder.position = INVALID_POSITION; mAttachedHolder.remove(holder); mRecycler.release(holder); }
From source file:com.yuntongxun.kitsdk.view.CCPFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (mLayoutListenerView == null) { mLayoutListenerView = inflater.inflate(R.layout.ytx_ccp_fragment, null); mCCProotView = (LinearLayout) mLayoutListenerView.findViewById(R.id.ccp_root_view); if (getTitleLayoutId() != -1) { // ???ActionBar?? mCCProotView.addView(inflater.inflate(getTitleLayoutId(), null), LinearLayout.LayoutParams.MATCH_PARENT, DensityUtil.getMetricsDensity(getActivity(), 50.0F)); }//from w ww . jav a 2s. co m // ?? if (getLayoutId() != -1) { mContentView = (ViewGroup) inflater.inflate(getLayoutId(), null); mCCProotView.addView(mContentView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); } } ViewGroup mViewRoot = (ViewGroup) mLayoutListenerView.getParent(); if (mViewRoot != null) { mViewRoot.removeView(mLayoutListenerView); } return mLayoutListenerView; }
From source file:jahirfiquitiva.iconshowcase.fragments.ApplyFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (layout != null) { ViewGroup parent = (ViewGroup) layout.getParent(); if (parent != null) { parent.removeView(layout); }/*from w ww . j a v a 2 s .c o m*/ } try { layout = (ViewGroup) inflater.inflate(R.layout.apply_section, container, false); } catch (InflateException e) { //Do nothing } mPrefs = new Preferences(getActivity()); showApplyAdviceDialog(getActivity()); recyclerView = (RecyclerView) layout.findViewById(R.id.launchersList); recyclerView.setLayoutManager( new GridLayoutManager(getActivity(), getResources().getInteger(R.integer.launchers_grid_width))); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.addItemDecoration( new GridSpacingItemDecoration(getResources().getInteger(R.integer.launchers_grid_width), getResources().getDimensionPixelSize(R.dimen.lists_padding), true)); return layout; }
From source file:jahirfiquitiva.iconshowcase.fragments.PreviewsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (layout != null) { ViewGroup parent = (ViewGroup) layout.getParent(); if (parent != null) { parent.removeView(layout); }/*from w ww. j a va 2s . co m*/ } try { layout = (ViewGroup) inflater.inflate(R.layout.icons_preview_section, container, false); } catch (InflateException e) { //Do nothing } categories = LoadIconsLists.getIconsCategories(); return layout; }