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:io.vit.vitio.Fragments.Courses.CoursesFragment.java

private void init(ViewGroup rootView) {
    Log.d("initcf", "initcf");
    adapter = new SliderAdapter(getChildFragmentManager());
    pager = (ViewPager) rootView.findViewById(R.id.pager);
    tabs = (SlidingTabLayout) rootView.findViewById(R.id.tabs);
    dataHandler = DataHandler.getInstance(getActivity());
    allCoursesList = dataHandler.getCoursesList();
    theme = new MyTheme(getActivity());
}

From source file:com.bruce.study.demo.studydata.viewpage.ViewPagerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    LayoutInflater inflater = getLayoutInflater();
    pageViews = new ArrayList<>(5);
    pageViews.add(inflater.inflate(R.layout.viewpager_item_01, null));
    pageViews.add(inflater.inflate(R.layout.viewpager_item_02, null));
    pageViews.add(inflater.inflate(R.layout.viewpager_item_03, null));
    pageViews.add(inflater.inflate(R.layout.viewpager_item_04, null));

    imageViews = new ImageView[pageViews.size()];
    ViewGroup main = (ViewGroup) inflater.inflate(R.layout.viewpager_activity, null);
    ViewGroup group = (ViewGroup) main.findViewById(R.id.ll_viewgroup);
    ViewPager viewPager = (ViewPager) main.findViewById(R.id.vp_guide);
    for (int i = 0; i < pageViews.size(); i++) {
        ImageView imageView = new ImageView(ViewPagerActivity.this);
        imageView.setLayoutParams(new ViewGroup.LayoutParams(20, 20));
        imageView.setPadding(20, 0, 20, 0);
        imageViews[i] = imageView;//from   w  w w.j a  va2s .  c om
        if (i == 0) {
            imageViews[i].setBackgroundResource(R.drawable.viewpager_indicator_focused);
        } else {
            imageViews[i].setBackgroundResource(R.drawable.viewpage_indicator);
        }
        group.addView(imageViews[i]);
    }
    setContentView(main);
    viewPager.setAdapter(new MyViewPagerAdapter());
    viewPager.setOnPageChangeListener(new PageChangeListener());
}

From source file:com.shinobicontrols.transitions.StoryDetailActivity.java

/**
 * Given a view group, then populate with the content from the node which has been loaded
 * into mItem/* w  w w .ja  v a  2  s  . c  o m*/
 * @param viewGroup The ViewGroup to populate with the content
 */
private void addContentToViewGroup(ViewGroup viewGroup) {
    if (mItem != null) {
        TextView contentTextView = (TextView) viewGroup.findViewById(R.id.story_content);
        if (contentTextView != null) {
            contentTextView.setText(getResources().getText(mItem.contentResourceId));
        }
        TextView titleTextView = (TextView) viewGroup.findViewById(R.id.story_title);
        if (titleTextView != null) {
            titleTextView.setText(mItem.title);
        }
        ImageView imageView = (ImageView) viewGroup.findViewById(R.id.story_image);
        if (imageView != null) {
            imageView.setImageResource(mItem.imageResourceId);
        }
    }
}

From source file:com.laowch.pulltoback.sample.ScreenSlidePageFragment.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);

    scroll = rootView;/*from w  ww . j a v  a 2 s .  c o m*/

    // Set the title view to show the page number.
    ((TextView) rootView.findViewById(android.R.id.text1)).setText("Step" + (mPageNumber + 1));

    return rootView;
}

From source file:com.univpm.s1055802.faceplusplustester.Gallery.GalleryImagesFragment.java

@Nullable
@Override//from w ww  .  j a  va2s . c o m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    //return super.onCreateView(inflater, container, savedInstanceState);
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.gallery_fragment, container, false);

    imagegrid = (GridView) rootView.findViewById(R.id.PhoneImageGrid);
    imagegrid.setAdapter(imageAdapter);

    return rootView;
}

From source file:it.iziozi.iziozi.gui.IOPaginatedBoardFragment.java

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

    ViewGroup mainView = (ViewGroup) inflater.inflate(R.layout.fragment_iopaginated_board, container, false);

    mViewPager = (ViewPager) mainView.findViewById(R.id.viewPager);
    mViewPager.setAdapter(new IOPaginatorAdapter(getFragmentManager(), mLevel));

    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override/*from  ww w.  ja va2 s. c  o m*/
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            if (mListener != null) {
                mListener.onPageScrolled(position);
            }
        }
    });

    return mainView;
}

From source file:com.example.testtab.fragment.GalleryPageFragment.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) rootView.findViewById(android.R.id.text1)).setText(getString(R.string.title_template_step, mPageNumber + 10));
    *///from w w w  .jav a 2s . com
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.gallery, container, false);

    this.mImageView = (ImageView) rootView.findViewById(R.id.image_view);
    this.mImageList = null;

    setGallery(rootView);

    return rootView;
}

From source file:io.vit.vitio.Fragments.Spotlight.SpotlightFragment.java

private void init(ViewGroup rootView) {
    adapter = new SliderAdapter(getChildFragmentManager());
    pager = (ViewPager) rootView.findViewById(R.id.pager);
    tabs = (SlidingTabLayout) rootView.findViewById(R.id.tabs);
    dataHandler = DataHandler.getInstance(getActivity());
    connectAPI = new ConnectAPI(getActivity());
    dialog = new ProgressDialog(getActivity());
    theme = new MyTheme(getActivity());
}

From source file:com.hacktx.android.fragments.TwitterFragment.java

@Nullable
@Override//from ww  w  .j ava2  s . c  om
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_twitter, container, false);

    setHasOptionsMenu(true);

    mEmptyLayout = (ConstraintLayout) root.findViewById(R.id.empty_view);

    setupToolbar((Toolbar) root.findViewById(R.id.toolbar), R.string.fragment_twitter_title);

    setupSwipeRefreshLayout(root);
    setupTwitter(root);
    setupEmptyLayout((TextView) root.findViewById(R.id.fragment_empty_title),
            (Button) root.findViewById(R.id.fragment_empty_btn));

    return root;
}

From source file:com.racoon.ampdroid.views.SelectedSongsView.java

@SuppressLint("InflateParams")
@Override// w  w  w . j a v a  2  s  .c o m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    controller = Controller.getInstance();
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.ampache_songs, null);
    ListView listview = (ListView) root.findViewById(R.id.songs_listview);
    registerForContextMenu(listview);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        listview.setFastScrollAlwaysVisible(true);
    }
    if (controller.getServer() != null) {
        ArrayList<String> list = new ArrayList<String>();
        for (Song s : controller.getSelectedSongs()) {
            list.add(s.toString());
        }
        SongArrayAdapter adapter = new SongArrayAdapter(getActivity().getApplicationContext(), list,
                controller.getSelectedSongs());
        listview.setAdapter(adapter);
        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
                Log.d("Play now added:", controller.getSongs().get(position).toString());
                controller.getPlayNow().add(controller.getSelectedSongs().get(position));
                Context context = view.getContext();
                CharSequence text = getResources().getString(R.string.songsViewSongAdded);
                int duration = Toast.LENGTH_SHORT;
                Toast toast = Toast.makeText(context, text, duration);
                toast.show();
            }

        });
    }
    setHasOptionsMenu(true);
    return root;
}