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.willyan.viewpagerslideanimation.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);

    // Set the title view to show the page number.
    ((ImageView) rootView.findViewById(R.id.background)).setImageResource(bgResId[mPageNumber]);

    return rootView;
}

From source file:gov.wa.wsdot.android.wsdot.ui.BlogDetailsFragment.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*  ww w .  java  2 s. c o  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview_with_spinner, null);
    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mLoadingSpinner.setVisibility(View.VISIBLE);
    webview = (WebView) root.findViewById(R.id.webview);
    webview.setWebViewClient(new myWebViewClient());
    webview.getSettings().setJavaScriptEnabled(true);

    return root;
}

From source file:com.esminis.server.library.dialog.about.AboutViewImpl.java

public AboutViewImpl(Context context, AboutPresenter presenter) {
    super(context, presenter);
    final LayoutInflater inflater = LayoutInflater.from(context);
    final ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.dialog_about, null);
    final TabHost tabhost = (TabHost) layout.findViewById(R.id.tabhost);
    tabhost.setup();//from ww w . j a  v a 2s.c  om
    addTab(tabhost, context, R.string.manual, viewTextManual = createText(inflater, layout));
    addTab(tabhost, context, R.string.about, viewTextAbout = createText(inflater, layout));
    addTab(tabhost, context, R.string.licenses, viewLicenses = new ProductLicensesViewer(context));
    setupTabTitles(tabhost);
    setView(layout);
    setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.close), (Message) null);
}

From source file:mx.udlap.is522.tedroid.fragment.InstructionsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_instructions, container, false);
    ImageView instructionImage = (ImageView) rootView.findViewById(R.id.instruction_image);
    TextView instructionText = (TextView) rootView.findViewById(R.id.instruction_text);
    int instructionImageContentDescriptionId = getTextByPageNumber();
    if (instructionImageContentDescriptionId != NOT_AN_ID) {
        Typeface typeface = Typefaces.get(getActivity(), Typefaces.Font.TWOBIT);
        instructionText.setText(instructionImageContentDescriptionId);
        instructionText.setTypeface(typeface);
        instructionImage.setContentDescription(getString(instructionImageContentDescriptionId));
    }//from  w  w w . j  a  v  a 2 s . c o m

    int instructionImageDrawableId = getDrawableByPageNumber();
    if (instructionImageDrawableId != NOT_AN_ID)
        instructionImage.setImageResource(instructionImageDrawableId);
    return rootView;
}

From source file:album.AlbumScreenSlide.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 + 1));
    return rootView;
}

From source file:com.google.blockly.android.WorkspaceFragment.java

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

    mVirtualWorkspaceView = (VirtualWorkspaceView) rootView.findViewById(R.id.virtual_workspace);
    mWorkspaceView = (WorkspaceView) rootView.findViewById(R.id.workspace);

    if (mController != null) {
        mVirtualWorkspaceView.setZoomBehavior(mController.getWorkspaceHelper().getZoomBehavior());
    }//  w w  w . j  a  va  2  s.c om

    return rootView;
}

From source file:com.willowtreeapps.spurceexampleapp.fragments.ViewFragment.java

@Nullable
@Override/*from ww  w  . j  a  va2 s .  c o  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, @Nullable Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.view_fragment, container, false);
    parent = (GridLayout) rootView.findViewById(R.id.view_group_to_animate);

    final int CHILD_VIEW_COUNT = parent.getColumnCount() * parent.getRowCount();

    for (int i = 0; i < CHILD_VIEW_COUNT; i++) {
        View childView = new View(getContext());
        childView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.spruceViewColor));
        childView.setAlpha(0F);
        parent.addView(childView);
        children.add(childView);
    }

    parent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            Resources res = getResources();
            int tileMargins = Math
                    .round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, res.getDisplayMetrics()));
            final int childWidth = parent.getWidth() / parent.getColumnCount() - (tileMargins * 2);
            final int childHeight = parent.getHeight() / parent.getRowCount() - (tileMargins * 2);

            for (int i = 0; i < parent.getChildCount(); i++) {
                View childView = parent.getChildAt(i);
                GridLayout.LayoutParams params = (GridLayout.LayoutParams) childView.getLayoutParams();
                params.width = childWidth;
                params.height = childHeight;
                params.setMargins(tileMargins, tileMargins, tileMargins, tileMargins);
                childView.setLayoutParams(params);
            }
            parent.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });

    listener.onParentAndChildrenPrepared(parent, children);

    return rootView;
}

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

private void init(ViewGroup rootView) {
    recyclerView = (RecyclerView) rootView.findViewById(R.id.spotlight_recycler_view);
    myTheme = new MyTheme(getActivity());
    typeface = myTheme.getMyThemeTypeface();
    noContentView = (TextView) rootView.findViewById(R.id.nocontent_text);
    swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
}

From source file:io.vit.vitio.Fragments.TimeTable.PagerFragment.java

private void init(ViewGroup rootView) {
    recyclerView = (RecyclerView) rootView.findViewById(R.id.timetable_recycler_view);
    myTheme = new MyTheme(getActivity());
    typeface = myTheme.getMyThemeTypeface();
    noClassView = (TextView) rootView.findViewById(R.id.no_classes_view);
    swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
}

From source file:cn.com.nggirl.ngdemo.transition.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);

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

    return rootView;
}