Example usage for android.view ViewGroup findViewById

List of usage examples for android.view ViewGroup findViewById

Introduction

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

Prototype

@Nullable
public final <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.

Usage

From source file:com.example.android.animationsdemo.ScreenSlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    //String barName = getType(1).get(0).name;
    // Inflate the layout containing a title and body text.
    container.findViewById(R.id.text);
    /*/*from   w w  w  .ja  v  a 2  s. c o  m*/
     ViewGroup rootView = (ViewGroup) inflater
        .inflate(R.layout.fragment_screen_slide_page, container, false);
     */
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.card_page, container, false);
    // Set the title view to show the page number.
    //((TextView) rootView.findViewById(R.id.name)).setText(barName);
    // ((TextView) rootView.findViewById(android.R.id.text2)).setText("hello");

    return rootView;
}

From source file:com.team.agita.langeo.FragmentSlideShow.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false);

    // Set the title view to show the page number.
    TextView text = (TextView) rootView.findViewById(R.id.text);
    text.setText(getString(R.string.title_template_step) + " " + Integer.toString(mPageNumber));
    return rootView;
}

From source file:io.vit.vitio.Fragments.CampusMapFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.campusmap_fragment, container, false);
    setTransitions();// w w w . j  a  va2 s. co m
    WebView view = (WebView) rootView.findViewById(R.id.img_map);
    view.setVisibility(View.GONE);

    view.getSettings().setBuiltInZoomControls(true);

    view.getSettings().setDisplayZoomControls(false);

    view.getSettings().setLoadWithOverviewMode(true);

    view.getSettings().setUseWideViewPort(true);

    view.setWebViewClient(new WebViewClient() {

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            try {
                view.setVisibility(View.VISIBLE);
            } catch (Exception ignore) {
            }

        }

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            try {
            } catch (Exception ignore) {
            }

        }
    });

    view.loadUrl("file:///android_asset/vit_map.jpg");

    return rootView;
}

From source file:com.rabross.android.minecraftskinwidget.InstructionPageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false);

    mTextView = (TextView) rootView.findViewById(R.id.instructions_text);
    mImageView = (ImageView) rootView.findViewById(R.id.instructions_image);

    setImage(mPageNumber);// w  w w  .  j a v  a2s . c o m

    return rootView;
}

From source file:finalproject.ece558.edu.pdx.ece.brailleblackjack.LearnBrailleFragment.java

/**
 * Brings the fragment into view by showing the image/card associated with th  page number
 * @param inflater//from  www .j  a va2s  .  c  om
 * @param container
 * @param savedInstanceState
 * @return ViewGroup
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_learn_braille, container, false);

    ImageView img = (ImageView) rootView.findViewById(R.id.learnBrailImg);

    switch (mPageNumber + 1) {
    case 1:
        // Switch to number card
        img.setImageDrawable(getResources().getDrawable(R.drawable.numbers));
        img.setContentDescription(getResources().getString(R.string.description_numbers));
        break;
    case 2:
        // Switch to capitalization card
        img.setImageDrawable(getResources().getDrawable(R.drawable.capital_letters));
        img.setContentDescription(getResources().getString(R.string.description_capitalization));
        break;
    case 3:
        // Switch to Alphabet a-m card
        img.setImageDrawable(getResources().getDrawable(R.drawable.letters_atom));
        img.setContentDescription(getResources().getString(R.string.description_letters_atom));
        break;
    case 4:
        // Switch to Alphabet n-z card
        img.setImageDrawable(getResources().getDrawable(R.drawable.letters_ntoz));
        img.setContentDescription(getResources().getString(R.string.description_letters_ntoz));
        break;
    default:
        break;
    }

    return rootView;
}

From source file:at.ac.uniklu.mobile.sportal.MensaMenuFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    MensaActivity ma = (MensaActivity) getActivity();

    if (ma.isDataAvailable()) {
        final MenuCategory mc = ma.getMenuCategory(mIndex);
        ViewGroup container = (ViewGroup) getView().findViewById(R.id.menu_items_container);
        LayoutInflater inflater = getLayoutInflater(getArguments());

        container.findViewById(R.id.mensa_website).setOnClickListener(new View.OnClickListener() {
            @Override/*from w  w  w. j  a v a2  s . c o m*/
            public void onClick(View v) {
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(mc.link)));
            }
        });

        for (MenuItem mi : mc.menuItems) {
            View menuItem = inflater.inflate(R.layout.mensa_menu_item, container, false);

            if (StringUtils.isEmpty(mi.title)) {
                menuItem.findViewById(R.id.text_title).setVisibility(View.GONE);
            } else {
                ((TextView) menuItem.findViewById(R.id.text_title)).setText(mi.title);
            }

            ((TextView) menuItem.findViewById(R.id.text_description)).setText(mi.description);

            if (!StringUtils.isEmpty(mi.description)) {
                container.addView(menuItem, container.getChildCount() - 1);
            }
        }
    }
}

From source file:com.ls.drupal8demo.ArticleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup result = (ViewGroup) inflater.inflate(R.layout.fragment_article, container, false);
    mContent = (WebView) result.findViewById(R.id.contentView);
    mProgressView = result.findViewById(R.id.progressView);
    resetPageContent();/*w ww .  j a  v a2s. com*/
    return result;
}

From source file:com.reddyetwo.hashmypass.app.tutorial.TutorialIntroFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_tutorial_intro, container, false);
    mIcMasterKeyView = (ImageView) rootView.findViewById(R.id.ic_master_key);
    mWebsiteTextView = (TextView) rootView.findViewById(R.id.website_text);
    mWebsitePasswordView = (TextView) rootView.findViewById(R.id.website_password);
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), Constants.FONT_MONOSPACE);
    mWebsitePasswordView.setTypeface(tf);

    mRandom = new Random();

    createAnimation();//from   w  w  w  . j  a va 2 s  .  c om

    return rootView;
}

From source file:com.cattle.fragments.SelectedPhotosFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.fragment_selected_photos, container, false);
    mGridView = (MyGridView) view.findViewById(R.id.gv_photos);
    mGridView.setOnItemClickListener(this);

    final boolean swipeToDismiss = getResources().getBoolean(R.bool.swipe_selected);
    // Check if we're set to swipe
    if (swipeToDismiss) {
        SwipeDismissListViewTouchListener swipeListener = new SwipeDismissListViewTouchListener(mGridView,
                this);
        mGridView.setOnTouchListener(swipeListener);
        mGridView.setOnScrollListener(swipeListener.makeScrollListener());
    }/*from  w  ww . j  a  va2s  . c  o m*/

    mAdapter = new SelectedPhotosBaseAdapter(getActivity(), !swipeToDismiss);
    mGridView.setAdapter(mAdapter);
    mGridView.setEmptyView(view.findViewById(android.R.id.empty));

    return view;
}

From source file:com.example.one.ScheduleSlideFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.schedule, container, false);

    ((TextView) rootView.findViewById(R.id.tvDay)).setText("Page # " + pageNumber);

    final List<ScheduleItem> aa = new ArrayList<ScheduleItem>();
    aa.add(new ScheduleItem("12:30", "Lunch", ItemType.Break));
    aa.add(new ScheduleItem("14:00", "Opening and Presentation of the Awards", ItemType.Separator));
    aa.add(new ScheduleItem("14:00", "Opening(Local Organizers)"));
    aa.add(new ScheduleItem("14:05", "Welcome TUM and LMU"));
    aa.add(new ScheduleItem("14:15", "Welcome BMBF and Presentation of the Bernstein Award 2012",
            ItemType.EventWithContent));
    aa.add(new ScheduleItem("14:15",
            "Enormously large title : Welcome BMBF and Presentation of the Bernstein Award 2012Welcome BMBF and Presentation of the Bernstein Award 2012"));
    aa.add(new ScheduleItem(null, "One more separator", ItemType.Separator));
    aa.add(new ScheduleItem("14:25", "Lecture by Bernstein Award Winner"));
    aa.add(new ScheduleItem("15:05", "Presentation of the Braitenberg Award 2012", ItemType.EventWithContent));
    aa.add(new ScheduleItem("15:10", "Lecture by the Braitenberg Award Winner"));
    aa.add(new ScheduleItem("15:50", "Coffee", ItemType.Break));

    final ListView list = (ListView) rootView.findViewById(R.id.list);
    BinderData bindingData = new BinderData(this.getActivity(), aa);
    list.setAdapter(bindingData);//from ww w  . ja  va  2  s .c o m

    list.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            if (aa.get(position).getItemType() == ItemType.Separator
                    || aa.get(position).getItemType() == ItemType.Break
                    || aa.get(position).getItemType() == ItemType.EventWithoutContent)
                return;
            Intent intent = new Intent(ScheduleSlideFragment.this.getActivity(), ContentExtended.class);
            intent.putExtra("title", aa.get(position).getTitle());
            intent.putExtra("content", aa.get(position).getContent());
            startActivity(intent);
        }
    });

    ImageButton ibLeft = (ImageButton) rootView.findViewById(R.id.ibLeft);
    if (pageNumber == 0)
        ibLeft.setVisibility(View.INVISIBLE);
    else
        ibLeft.setVisibility(View.VISIBLE);

    ibLeft.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (pager.getCurrentItem() > 0)
                pager.setCurrentItem(pager.getCurrentItem() - 1, true);
        }
    });

    ImageButton ibRight = (ImageButton) rootView.findViewById(R.id.ibRight);
    if (pageNumber + 1 == PAGE_NUM)
        ibRight.setVisibility(View.INVISIBLE);
    else
        ibRight.setVisibility(View.VISIBLE);

    ibRight.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (pager.getCurrentItem() < PAGE_NUM)
                pager.setCurrentItem(pager.getCurrentItem() + 1, true);
        }
    });

    return rootView;
}