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.by_syk.lib.nanoiconpack.dialog.UserDialog.java

@NonNull
@Override/*from w w w.j  a v a 2s.  co m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ViewGroup viewGroup = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.dialog_key, null);
    etUser = (EditText) viewGroup.findViewById(R.id.et_user);

    AlertDialog alertDialog = new AlertDialog.Builder(getContext()).setTitle(R.string.dlg_title_set_key)
            .setView(viewGroup).setPositiveButton(R.string.dlg_bt_ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    if (onContinueListener != null) {
                        onContinueListener.onContinue(etUser.getText().toString().trim());
                    }
                }
            }).create();
    alertDialog.setCanceledOnTouchOutside(false);

    return alertDialog;
}

From source file:com.example.client.fragment.imported.ViewPagerTabFragmentGridViewFragment.java

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

    final ObservableGridView gridView = (ObservableGridView) view.findViewById(R.id.scroll);
    setDummyData(gridView);//from  w ww.jav a2 s. c  o  m

    Fragment parentFragment = getParentFragment();
    ViewGroup viewGroup = (ViewGroup) parentFragment.getView();
    if (viewGroup != null) {
        gridView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container));
        if (parentFragment instanceof ObservableScrollViewCallbacks) {
            gridView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment);
        }
    }
    return view;
}

From source file:com.example.client.fragment.imported.ViewPagerTabFragmentListViewFragment.java

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

    final ObservableListView listView = (ObservableListView) view.findViewById(R.id.scroll);
    setDummyData(listView);//from ww w  .j  a v  a 2 s .  co m

    Fragment parentFragment = getParentFragment();
    ViewGroup viewGroup = (ViewGroup) parentFragment.getView();
    if (viewGroup != null) {
        listView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container));
        if (parentFragment instanceof ObservableScrollViewCallbacks) {
            listView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment);
        }
    }
    return view;
}

From source file:net.olejon.mdapp.WelcomeFourthFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mActivity = getActivity();/* w w w  .  j ava  2s  .c  om*/

    mTools = new MyTools(mActivity);

    ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_welcome_fourth, container, false);

    TextView textView = (TextView) viewGroup.findViewById(R.id.welcome_page_4_button);

    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mTools.setSharedPreferencesBoolean("WELCOME_ACTIVITY_HAS_BEEN_SHOWN", true);

            mActivity.finish();
            mActivity.overridePendingTransition(0, R.anim.welcome_finish);
        }
    });

    return viewGroup;
}

From source file:com.ibuildapp.romanblack.CataloguePlugin.fragments.DetailsItemFragment.java

@Nullable
@Override/*from  ww  w  .  j a v a2  s. com*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.details_viewer_item_layout, container, false);

    view = (ImageView) rootView.findViewById(R.id.details_viewer_item_image);
    progress = (ProgressBar) rootView.findViewById(R.id.details_viewer_item_progress);
    progress.setVisibility(View.VISIBLE);
    getBitmap(entity, new ImageTask.OnBitmapPreparedListener() {
        @Override
        public void onBitmapPrepared(final Bitmap bitmap) {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    view.setImageBitmap(bitmap);
                }
            });
            progress.setVisibility(View.GONE);
        }
    });

    return rootView;
}

From source file:com.jacr.instagramtrendreader.MainFragment.java

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

    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.frg_main, container, false);

    ImageView imv = (ImageView) view.findViewById(R.id.upperImg);
    imv.setImageURI(Uri.fromFile(new File(imagePath)));
    imv.setOnClickListener(new OnClickListener() {

        @Override//from w w  w  .  ja  v a 2 s . com
        public void onClick(View v) {
            Bundle b = new Bundle();
            b.putInt(Main.ACTION_IMAGE_CLICK, key);
            Util.sendBroadcast(getActivity(), Main.ACTION_IMAGE_CLICK, b);

        }

    });

    return view;

}

From source file:org.ayo.robot.anim.transitioneverywhere.RecolorSample.java

@Nullable
@Override//from w  w w. j  a  v  a  2  s . c  o m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_recolor, container, false);

    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final Button button = (Button) transitionsContainer.findViewById(R.id.button1);

    button.setOnClickListener(new View.OnClickListener() {

        boolean mColorsInverted;

        @Override
        public void onClick(View v) {
            TransitionManager.beginDelayedTransition(transitionsContainer, new Recolor());

            mColorsInverted = !mColorsInverted;
            button.setTextColor(
                    getResources().getColor(!mColorsInverted ? R.color.second_accent : R.color.accent));
            button.setBackgroundDrawable(new ColorDrawable(
                    getResources().getColor(!mColorsInverted ? R.color.accent : R.color.second_accent)));
        }

    });

    return view;
}

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

private void init(ViewGroup rootView) {
    recyclerView = (RecyclerView) rootView.findViewById(R.id.courses_recycler_view);
    myTheme = new MyTheme(getActivity());
    typeface = myTheme.getMyThemeTypeface();
    parseTimeTable = new ParseTimeTable(CoursesFragment.allCoursesList, DataHandler.getInstance(getActivity()));
    noClassView = (ImageView) rootView.findViewById(R.id.noclass_image);
}

From source file:org.ayo.robot.anim.transitioneverywhere.ChangeTextSample.java

@Nullable
@Override/*from  w ww. ja  v  a 2s .co  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_change_text, container, false);

    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final TextView textView = (TextView) transitionsContainer.findViewById(R.id.text1);

    textView.setText(TEXT_1);
    textView.setOnClickListener(new View.OnClickListener() {

        boolean mSecondText;

        @Override
        public void onClick(View v) {
            mSecondText = !mSecondText;
            TransitionManager.beginDelayedTransition(transitionsContainer,
                    new ChangeText().setChangeBehavior(ChangeText.CHANGE_BEHAVIOR_OUT_IN));
            textView.setText(mSecondText ? TEXT_2 : TEXT_1);
        }

    });

    return view;
}

From source file:com.example.client.fragment.imported.ViewPagerTabFragmentRecyclerViewFragment.java

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

    final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setHasFixedSize(false);
    setDummyData(recyclerView);/* w  ww .j av a 2 s . c  om*/

    Fragment parentFragment = getParentFragment();
    ViewGroup viewGroup = (ViewGroup) parentFragment.getView();
    if (viewGroup != null) {
        recyclerView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container));
        if (parentFragment instanceof ObservableScrollViewCallbacks) {
            recyclerView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment);
        }
    }
    return view;
}