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.aptoide.amethyst.ui.ViewPagerAdapterScreenshots.java

@Override
public Object instantiateItem(ViewGroup container, final int position) {

    @SuppressLint("InflateParams")
    final View v = LayoutInflater.from(container.getContext()).inflate(R.layout.row_item_screenshots_big, null);
    Glide.with(container.getContext()).load(urls.get(position))
            .placeholder(getPlaceholder(container.getContext()))
            .into((ImageView) v.findViewById(R.id.screenshot_image_big));
    container.addView(v);
    return v;//from  www .j  ava 2 s.co  m
}

From source file:com.fuzz.emptyhusk.SimplePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    String value = values[position];

    LayoutInflater inflater = LayoutInflater.from(container.getContext());
    View inflated = inflater.inflate(R.layout.pager_cell_text, container, false);
    TextView item = (TextView) inflated.findViewById(R.id.cell_text);

    item.setText(value);//from   w ww.j av a  2 s .c  o  m

    viewCache.put(value, inflated);

    container.addView(inflated);

    return value;
}

From source file:android.support.car.app.menu.CarDrawerActivity.java

@Override
public void setContentView(View view) {
    ViewGroup parent = (ViewGroup) findViewById(mUiController.getFragmentContainerId());
    parent.addView(view);
}

From source file:com.jins_meme.bridge.CameraMenuFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View uiView = super.onCreateView(inflater, container, savedInstanceState);
    ViewGroup parent = (LinearLayout) inflater.inflate(R.layout.fragment_camera, container, false);
    parent.addView(uiView);
    ((LayoutParams) uiView.getLayoutParams()).height = 0;
    ((LayoutParams) uiView.getLayoutParams()).weight = 1;
    // Inflate the layout for this fragment
    return parent;
}

From source file:de.gebatzens.sia.fragment.RemoteDataFragment.java

public TextView createPrimaryTextView(String text, int size, LayoutInflater inflater, ViewGroup group) {
    TextView t = (TextView) inflater.inflate(R.layout.basic_textview_primary, group, false);
    t.setText(text);/*from www .  j  av  a2 s.  c om*/
    t.setPadding(0, 0, toPixels(20), 0);
    t.setTextSize(size);
    group.addView(t);
    return t;
}

From source file:com.google.reviewit.ReviewChangesFragment.java

private void addSeparator(ViewGroup viewGroup) {
    View separator = new View(getContext());
    separator.setLayoutParams(matchAndFixedLayout(widgetUtil.dpToPx(1)));
    separator.setBackgroundColor(widgetUtil.color(R.color.separator));
    viewGroup.addView(separator);
}

From source file:de.gebatzens.sia.fragment.RemoteDataFragment.java

public TextView createSecondaryTextView(String text, int size, LayoutInflater inflater, ViewGroup group) {
    TextView t = (TextView) inflater.inflate(R.layout.basic_textview_secondary, group, false);
    t.setText(text);//from w ww . j a  v  a 2 s  .  co  m
    t.setPadding(0, 0, toPixels(20), 0);
    t.setTextSize(size);
    group.addView(t);
    return t;
}

From source file:com.andremion.louvre.preview.PreviewAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = mInflater.inflate(R.layout.page_item_preview, container, false);
    ViewHolder holder = new ViewHolder(view);
    Uri data = getData(position);/*from w w  w .ja  v  a 2  s.  c o  m*/
    onViewBound(holder, position, data);
    container.addView(holder.itemView);
    return holder;
}

From source file:com.yojiokisoft.yumekanow.adapter.BackImagePagerAdapter.java

/**
 * @see PagerAdapter#instantiateItem(ViewGroup, int)
 *//*from ww  w . ja va  2s  . c o  m*/
@Override
public Object instantiateItem(ViewGroup container, int position) {
    mImageView = new ImageView(mContext);
    mImageView.setPadding(0, 5, 0, 0);
    mImageView.setBackgroundColor(0xFF000000);
    mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);

    BackImageEntity item = mList.get(position);
    MyImage.setImage(mImageView, item);

    // ?
    container.addView(mImageView);

    return mImageView;
}

From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.IMObj.java

public void render(Context context, ViewGroup frame, Obj obj, boolean allowInteractions) {
    JSONObject content = obj.getJson();//from w  ww  .ja  v a  2  s . co  m
    TextView valueTV = new TextView(context);
    valueTV.setText("IM:" + content.optString(TEXT));
    valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    valueTV.setGravity(Gravity.TOP | Gravity.LEFT);
    frame.addView(valueTV);
}