Example usage for android.view ViewGroup addView

List of usage examples for android.view ViewGroup addView

Introduction

In this page you can find the example usage for android.view ViewGroup addView.

Prototype

public void addView(View child) 

Source Link

Document

Adds a child view.

Usage

From source file:com.twitter.sdk.android.tweetui.GalleryAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    final GalleryImageView root = new GalleryImageView(context);
    root.setSwipeToDismissCallback(callback);

    container.addView(root);

    final MediaEntity entity = items.get(position);
    Picasso.with(context).load(entity.mediaUrlHttps).into(root);

    return root;/*from  w w  w  . ja  v a 2  s . co m*/
}

From source file:com.android.settings.PreviewPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    container.addView(mPreviewFrames[position]);
    return mPreviewFrames[position];
}

From source file:com.example.fansonlib.widget.calendar.MonthSelectLayout.java

void init(int year) {
    if (isInit) {
        setCurrentItem(year - mMinYear);
        return;// w  ww  . j  ava  2  s.  co  m
    }
    setAdapter(new PagerAdapter() {
        @Override
        public int getCount() {
            return mMaxYear - mMinYear;
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            MonthRecyclerView view = new MonthRecyclerView(getContext());
            container.addView(view);
            view.setOnMonthSelectedListener(mListener);
            view.setSchemeColor(mSchemeColor);
            view.init(position + mMinYear);
            view.setSchemes(mSchemes);
            return view;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            if (object instanceof MonthRecyclerView)
                container.removeView((MonthRecyclerView) object);
        }
    });
    isInit = true;
    setCurrentItem(year - mMinYear);
}

From source file:com.lightydev.dk.widget.PagerCursorAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    if (mCursor.moveToPosition(position)) {
        final View view = getItem(mContext, mCursor, container);
        container.addView(view);
        return view;
    }/*from w w w.j  a va2s  .  c o m*/
    throw new IllegalStateException("couldn't move cursor to position " + position);
}

From source file:com.sunrun.sunrunframwork.adapter.ImagePagerAdapter.java

@Override
public final Object instantiateItem(ViewGroup container, int position) {
    View view = null;/* w w  w  .  ja  va 2 s .co  m*/
    view = getView(position, view, container);
    container.addView(view);
    return view;
}

From source file:com.yanzhenjie.album.adapter.BasicPreviewAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    AttacherImageView imageView = new AttacherImageView(container.getContext());
    imageView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
    container.addView(imageView);
    final PhotoViewAttacher attacher = new PhotoViewAttacher(imageView);
    imageView.setAttacher(attacher);//from   w  w w. j av a 2 s  .c  o m

    Album.getAlbumConfig().getImageLoader().loadImage(imageView, getImagePath(mPreviewList.get(position)),
            DisplayUtils.screenWidth, DisplayUtils.screenHeight);
    return imageView;
}

From source file:com.nextgis.maplibui.formcontrol.DoubleCombobox.java

@Override
public void addToLayout(ViewGroup layout) {
    layout.addView(this);
    layout.addView(mSubCombobox);
}

From source file:com.duy.pascal.ui.common.adapter.ViewPagerAdapter.java

/**
 * Create the page for the given position.
 *
 * @param container The containing View in which the page will be shown.
 * @param position  The page position to be instantiated.
 *
 * @return Returns an Object representing the new page. This does not need
 *         to be a View, but can be some other container of the page.
 *//*from w  w  w  .  ja  v a 2  s .  co m*/
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = getView(position, container);

    if (view != mCurrentPrimaryItem) {
        view.setVisibility(View.INVISIBLE);
    }

    container.addView(view);

    return view;
}

From source file:com.lamcreations.scaffold.common.adapters.ImagePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    Context context = container.getContext();
    View view = LayoutInflater.from(context).inflate(getLayoutResId(), container, false);
    bindView(view, position);/*from w w w  . ja  v  a 2s .  co m*/
    container.addView(view);
    return view;
}

From source file:at.wada811.android.library.demos.app.TabViewPagerAdapter.java

@Override
public View instantiateItem(ViewGroup container, int position) {
    View page = mInflater.inflate(R.layout.layout_page, container, false);
    TextView textView = (TextView) page.findViewById(R.id.text);
    textView.setText("Tab " + position);
    container.addView(page);
    return page;//  w  w w . j a  va2 s .co m
}