List of usage examples for android.view ViewGroup addView
public void addView(View child)
Adds a child view.
From source file:com.android.talkbacktests.testsession.SimplePageAdapter.java
@Override public Object instantiateItem(ViewGroup collection, int position) { TextView textView = (TextView) LayoutInflater.from(mContext).inflate(R.layout.fragment_simple_text, collection, false);//from w ww . j ava 2 s .c om textView.setText(mContext.getString(R.string.simple_tab_content_template, (position + 1))); collection.addView(textView); return textView; }
From source file:com.cryart.sabbathschool.adapter.SSReadingViewAdapter.java
@Override public Object instantiateItem(ViewGroup collection, int position) { LayoutInflater inflater = LayoutInflater.from(mContext); ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.ss_reading_view, collection, false); collection.addView(layout); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.mContext); SSReadingDisplayOptions ssReadingDisplayOptions = new SSReadingDisplayOptions( prefs.getString(SSConstants.SS_SETTINGS_THEME_KEY, SSReadingDisplayOptions.SS_THEME_LIGHT), prefs.getString(SSConstants.SS_SETTINGS_SIZE_KEY, SSReadingDisplayOptions.SS_SIZE_MEDIUM), prefs.getString(SSConstants.SS_SETTINGS_FONT_KEY, SSReadingDisplayOptions.SS_FONT_LATO)); final SSReadingView ssReadingView = layout.findViewById(R.id.ss_reading_view); ssReadingView.setReadingDisplayOptions(ssReadingDisplayOptions); ssReadingView.setContextMenuCallback(ssReadingViewModel); ssReadingView.setHighlightsCommentsCallback(ssReadingViewModel); ssReadingView.setReadHighlights(ssReadHighlights.get(position)); ssReadingView.setReadComments(ssReadComments.get(position)); ssReadingView.loadRead(ssReads.get(position)); final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override//from w ww .jav a2s .c o m public void run() { if (ssReadingView != null) { ssReadingView.updateHighlights(); ssReadingView.updateComments(); } } }, 800); layout.setTag("ssReadingView_" + position); return layout; }
From source file:de.gebatzens.ggvertretungsplan.fragment.RemoteDataFragment.java
public void setFragmentLoading() { if (getView() == null) return;/*from w ww. j ava 2 s . c o m*/ ViewGroup vg = getContentView(); vg.removeAllViews(); vg.addView(createLoadingView()); }
From source file:com.mvcoding.financius.feature.introduction.IntroductionAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { final IntroductionView introductionView = (IntroductionView) LayoutInflater.from(container.getContext()) .inflate(R.layout.view_introduction, container, false); introductionView.setIntroduction(introductions.get(position)); container.addView(introductionView); return introductionView; }
From source file:com.rubengees.introduction.IntroductionFragment.java
@NonNull private View initViews(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.introduction_fragment, container, false); ViewGroup contentContainer = (ViewGroup) root.findViewById(R.id.introduction_fragment_content_container); if (slide.getCustomViewBuilder() == null) { contentContainer.addView(initDefaultViews(inflater, container)); } else {/*from www .ja va 2 s. co m*/ contentContainer.addView(initCustomViews(inflater, container)); } root.setBackgroundColor(slide.getColor()); root.setTag(slide.getPosition()); return root; }
From source file:cn.zhangls.android.weibo.common.SwipeActivity.java
/** * ?// w w w . j av a 2 s .c o m */ private void initSwipeBackFinish() { SlidingPaneLayout slidingPaneLayout = new SlidingPaneLayout(this); //???mOverhangSize0mOverhangSize????? //32dp?0 try { // Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize"); f_overHang.setAccessible(true); f_overHang.set(slidingPaneLayout, 0); } catch (Exception e) { e.printStackTrace(); } slidingPaneLayout.setPanelSlideListener(this); slidingPaneLayout.setSliderFadeColor(getResources().getColor(android.R.color.transparent)); View leftView = new View(this); leftView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); slidingPaneLayout.addView(leftView, 0); ViewGroup decor = (ViewGroup) getWindow().getDecorView(); ViewGroup decorChild = (ViewGroup) decor.getChildAt(0); decorChild.setBackgroundColor(getResources().getColor(android.R.color.white)); decor.removeView(decorChild); decor.addView(slidingPaneLayout); slidingPaneLayout.addView(decorChild, 1); }
From source file:com.google.reviewit.ReviewChangesFragment.java
private void display(List<Change> changes) { setInvisible(v(R.id.progress));//from w w w. j av a2 s . c o m setGone(v(R.id.initialProgress, R.id.reloadButton, R.id.nextPageProgress, R.id.statusText)); ((SwipeRefreshLayout) v(R.id.swipeRefreshLayout)).setRefreshing(false); ViewGroup changeList = vg(R.id.changeList); for (Change change : changes) { changeList.addView(createChangeEntry(change)); addSeparator(changeList); } }
From source file:com.cullaboration.userhookdemo.MainActivity.java
public void addView(final View view) { this.runOnUiThread(new Runnable() { @Override/* ww w. jav a 2 s . c om*/ public void run() { ViewGroup rootView = (ViewGroup) findViewById(android.R.id.content); rootView.addView(view); } }); }
From source file:com.yanzhenjie.album.app.gallery.PreviewAdapter.java
@NonNull @Override//from w w w . j a v a2 s . co m public Object instantiateItem(@NonNull ViewGroup container, int position) { AttacherImageView imageView = new AttacherImageView(mContext); imageView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1)); loadPreview(imageView, mPreviewList.get(position), position); container.addView(imageView); final PhotoViewAttacher attacher = new PhotoViewAttacher(imageView); if (mItemClickListener != null) { attacher.setOnViewTapListener(this); } if (mItemLongClickListener != null) { attacher.setOnLongClickListener(this); } imageView.setAttacher(attacher); return imageView; }
From source file:android.support.test.testapp.SimplePagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); View view = inflater.inflate(R.layout.pager_view, null); ((TextView) view.findViewById(R.id.pager_content)).setText("Position #" + position); view.setBackgroundColor(COLORS[position]); container.addView(view); return view;/* w ww. j a v a 2 s .co m*/ }