Example usage for android.view LayoutInflater inflate

List of usage examples for android.view LayoutInflater inflate

Introduction

In this page you can find the example usage for android.view LayoutInflater inflate.

Prototype

public View inflate(XmlPullParser parser, @Nullable ViewGroup root) 

Source Link

Document

Inflate a new view hierarchy from the specified xml node.

Usage

From source file:at.alladin.rmbt.android.views.ResultQoSDetailView.java

/**
 * /*w ww  .j ava 2 s  .c o m*/
 * @param inflater
 * @return
 */
public View createView(final LayoutInflater inflater) {
    final View view = inflater.inflate(R.layout.result_qos_details, this);

    return view;
}

From source file:com.lillicoder.newsblurry.stories.StoriesListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_stories_list, null);

    this._storiesList = (ListView) root.findViewById(R.id.StoriesListFragment_storiesList);
    this._labeledProgresssBar = (LabeledProgressBar) root
            .findViewById(R.id.StoriesListFragment_labeledProgressBar);

    return root;/*from ww  w .ja va  2 s  .c  o  m*/
}

From source file:com.imobilize.blogposts.adapters.ArticlesArrayAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    View v = convertView;/*  w  w w  .j  a va 2  s . co m*/
    ViewHolder viewHolder;

    if (v == null) {
        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = inflater.inflate(R.layout.listview_layout, null);

        viewHolder = new ViewHolder();
        viewHolder.articleImage = (NetworkImageView) v.findViewById(R.id.articleImage);
        viewHolder.articleTitle = (TextView) v.findViewById(R.id.articleTitle);
        viewHolder.articleDescription = (TextView) v.findViewById(R.id.articleDescription);
        viewHolder.articleMetadata = (TextView) v.findViewById(R.id.articleMetadata);

        v.setTag(viewHolder);

    } else {
        viewHolder = (ViewHolder) v.getTag();
    }

    Article article = articles.get(position);
    if (article != null) {
        viewHolder.articleImage.setImageUrl(
                Constants.blogHostAndPort + Constants.blogURLFirstPart + article.getKey(),
                ImageCacheManager.getInstance().getImageLoader());
        viewHolder.articleTitle.setText(article.getTitle());
        viewHolder.articleDescription.setText(article.getDescription());
        viewHolder.articleMetadata
                .setText("Posted by " + article.getAuthor() + " on " + article.getCreationDate());
        viewHolder.articleContent = article.getContent();
        viewHolder.articleKey = article.getKey();
    }

    return v;
}

From source file:de.devmil.common.ui.color.HistorySelectorView.java

private void init() {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View content = inflater.inflate(R.layout.color_historyview, null);
    addView(content, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.FILL_PARENT));

    readColors();//from  w ww  .  j a  v a  2s  . co  m

    makeColorList();
}

From source file:com.orange.ocara.ui.activity.IllustrationsActivity.java

@AfterViews
protected void setUpViewFlipper() {

    updateArrows(selectedIndex);/*from w w w . j a v  a  2s .c o m*/
    int nbIllustrations = titles.length;
    for (int i = 0; i < nbIllustrations; i++) {
        LayoutInflater inflater = (LayoutInflater) this.getSystemService((Context.LAYOUT_INFLATER_SERVICE));
        View view = inflater.inflate(com.orange.ocara.R.layout.illustration, null);
        viewFlipper.addView(view);
        commentPicture = (TextView) view.findViewById(com.orange.ocara.R.id.comment_picture);
        photo = (ImageView) view.findViewById(com.orange.ocara.R.id.photo);

        if (!StringUtils.isEmpty(comments[i])) {
            commentPicture.setText(comments[i]);
        }

        if (!StringUtils.isEmpty(images[i])) {
            picasso.load(images[i]).placeholder(com.orange.ocara.R.color.black50).fit().into(photo);
        }

    }

    viewFlipper.setDisplayedChild(selectedIndex);

    leftButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            viewFlipper.showPrevious();
            Timber.v("index " + viewFlipper.indexOfChild(viewFlipper.getCurrentView()));
            int index = viewFlipper.indexOfChild(viewFlipper.getCurrentView());
            updateTitle(index);
            updateArrows(index);
        }
    });

    rightButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            viewFlipper.showNext();
            Timber.v("index " + viewFlipper.indexOfChild(viewFlipper.getCurrentView()));
            int index = viewFlipper.indexOfChild(viewFlipper.getCurrentView());
            updateTitle(index);
            updateArrows(index);
        }
    });

}

From source file:com.codebutler.farebot.fragments.CardTripsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_card_trips, null);

    if (mTransitData.getTrips() != null && mTransitData.getTrips().length > 0)
        setListAdapter(new UseLogListAdapter(getActivity(), mTransitData.getTrips()));
    else {/*from  w  w  w  .java2  s.co  m*/
        view.findViewById(android.R.id.list).setVisibility(View.GONE);
        view.findViewById(R.id.error_text).setVisibility(View.VISIBLE);
    }

    return view;
}

From source file:com.lillicoder.newsblurry.feeds.FeedsListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_feeds_list, null);

    this._feedsList = (ListView) root.findViewById(R.id.FeedsListFragment_feedsList);
    this._labeledProgresssBar = (LabeledProgressBar) root
            .findViewById(R.id.FeedsListFragment_labeledProgressBar);

    return root;/*from   w ww.java  2s  .  c  om*/
}

From source file:com.heneryh.aquanotes.ui.controllers.OutletsDataFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(// ww  w  .java  2 s.com
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    return root;
}

From source file:codepath.watsiapp.activities.BaseFragmentActivity.java

private void showThankYouNote() {
    LayoutInflater inflater = this.getLayoutInflater();
    View view = inflater.inflate(R.layout.toast_thanks_for_donation,
            (ViewGroup) this.findViewById(R.id.thanks_note));
    Toast toast = new Toast(this);
    toast.setView(view);/* ww w  .ja  v  a2 s.co m*/
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.setDuration(Toast.LENGTH_LONG);
    toast.show();

}

From source file:it.crs4.most.ehrlib.widgets.DvBooleanWidget.java

/**
 * Instantiates a new {@link DvBooleanWidget}
 *
 * @param provider the widget provider/*  w  w w.  ja  v a2s .  c o  m*/
 * @param name the name of this widget
 * @param path the path of the {@link DvBoolean} mapped on this widget
 * @param attributes the attributes of the {@link DvBoolean} mapped on this widget
 * @param parentIndex the parent index
 */
public DvBooleanWidget(WidgetProvider provider, String name, String path, JSONObject attributes,
        int parentIndex) {
    super(provider, name, new DvBoolean(path, attributes), parentIndex);

    LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.dv_boolean, null);

    _root_view = view;

    _chkBoolean = (CheckBox) _root_view.findViewById(R.id.check_is_selected);

    this.updateLabelsContent();

    _help = (ImageView) _root_view.findViewById(R.id.image_help);

    toolTipRelativeLayout = (ToolTipRelativeLayout) _root_view
            .findViewById(R.id.activity_main_tooltipRelativeLayout);

    _help.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (myToolTipView == null) {
                myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, _help);
            } else {
                myToolTipView.remove();
                myToolTipView = null;

            }
        }
    });

}