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.flan.stock.adapter.NewsTouTiaoViewPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    container.addView(viewList.get(position));
    return viewList.get(position);
}

From source file:com.battlelancer.seriesguide.util.PeopleListHelper.java

/**
 * Add views for at most three crew members to the given {@link android.view.ViewGroup} and a
 * "Show all" link if there are more.//from  w  w  w  . j  a v a2s .c om
 */
private static void populateCrew(Context context, LayoutInflater inflater, ViewGroup peopleContainer,
        Credits credits, PeopleActivity.MediaType mediaType) {
    if (peopleContainer == null) {
        // nothing we can do, view is already gone
        Timber.d("populateCrew: container reference gone, aborting");
        return;
    }

    peopleContainer.removeAllViews();

    // show at most 3 crew members
    List<Credits.CrewMember> crew = credits.crew;
    for (int i = 0; i < Math.min(3, crew.size()); i++) {
        Credits.CrewMember castMember = crew.get(i);

        View personView = createPersonView(context, inflater, peopleContainer, castMember.name, castMember.job,
                castMember.profile_path);
        personView.setOnClickListener(new OnPersonClickListener(mediaType, credits.id,
                PeopleActivity.PeopleType.CREW, castMember.id));

        peopleContainer.addView(personView);
    }

    if (crew.size() > 3) {
        addShowAllView(inflater, peopleContainer,
                new OnPersonClickListener(mediaType, credits.id, PeopleActivity.PeopleType.CREW));
    }
}

From source file:com.agateau.utils.ui.ViewPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = mViews.get(position);
    container.addView(view);
    return view;//from   w  ww.  ja  va  2s  . c o m
}

From source file:cm.aptoide.pt.adapters.ViewPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View v = views.get(position);
    container.addView(v);
    return v;//from  w ww . j  av a 2s.c  o m
}

From source file:com.pranavpandey.smallapp.adapter.ViewPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View page = pages.get(position);
    container.addView(page);
    return page;/*www  . ja  v  a2  s .c  om*/
}

From source file:com.battlelancer.seriesguide.util.PeopleListHelper.java

/**
 * Add views for at most three cast members to the given {@link android.view.ViewGroup} and a
 * "Show all" link if there are more./*from  ww  w  . jav a  2s . c  o  m*/
 */
private static void populateCast(Context context, LayoutInflater inflater, ViewGroup peopleContainer,
        Credits credits, PeopleActivity.MediaType mediaType) {
    if (peopleContainer == null) {
        // nothing we can do, view is already gone
        Timber.d("populateCast: container reference gone, aborting");
        return;
    }

    peopleContainer.removeAllViews();

    // show at most 3 cast members
    List<Credits.CastMember> cast = credits.cast;
    for (int i = 0; i < Math.min(3, cast.size()); i++) {
        Credits.CastMember castMember = cast.get(i);

        View personView = createPersonView(context, inflater, peopleContainer, castMember.name,
                castMember.character, castMember.profile_path);
        personView.setOnClickListener(new OnPersonClickListener(mediaType, credits.id,
                PeopleActivity.PeopleType.CAST, castMember.id));

        peopleContainer.addView(personView);
    }

    if (cast.size() > 3) {
        addShowAllView(inflater, peopleContainer,
                new OnPersonClickListener(mediaType, credits.id, PeopleActivity.PeopleType.CAST));
    }
}

From source file:com.ipassistat.ipa.adapter.GoodsBannerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = imageIdList.get(position);
    container.addView(view);
    return view;/*from  w w w .j av a2  s  . co m*/
}

From source file:com.pdftron.pdf.utils.StickyNotePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = mMainView.findViewById(mData.get(position));
    container.addView(view);
    return view;/*from ww w  .  j  a v a  2 s . co  m*/
}

From source file:com.nps.micro.view.BaseSectionFragment.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    ViewGroup rootView = (ViewGroup) getView();
    rootView.removeAllViews();/*  w ww . j av a 2s.c  om*/
    rootView.addView(buildRootView(inflater, rootView));
}

From source file:com.telenav.expandablepager.ExpandablePagerAdapter.java

/**
 * Attaches the view to the container and gives it a specific id. Return the result of this method when overriding {@link #instantiateItem(ViewGroup, int)}
 * @param container view container/*from  www  .  j a va 2  s  .  c o m*/
 * @param v inflated view
 * @param position position of the view in the adapter
 * @return inflated view
 */
protected View attach(ViewGroup container, View v, int position) {
    v.setId(ExpandablePager.INTERNAL_PAGE_ID + position);
    container.addView(v);
    return v;
}