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.simplelecture.main.fragments.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);

    ImageView imageView = (ImageView) rootView.findViewById(R.id.imageView);
    imageView.setImageResource(mResources[mPageNumber]);

    return rootView;
}

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

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

    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final ImageView imageView = (ImageView) transitionsContainer.findViewById(R.id.image);

    imageView.setOnClickListener(new View.OnClickListener() {

        boolean mExpanded;

        @Override
        public void onClick(View v) {
            mExpanded = !mExpanded;

            TransitionManager.beginDelayedTransition(transitionsContainer, new TransitionSet()
                    .addTransition(new ChangeBounds()).addTransition(new ChangeImageTransform()));

            ViewGroup.LayoutParams params = imageView.getLayoutParams();
            params.height = mExpanded ? ViewGroup.LayoutParams.MATCH_PARENT
                    : ViewGroup.LayoutParams.WRAP_CONTENT;
            imageView.setLayoutParams(params);

            imageView
                    .setScaleType(mExpanded ? ImageView.ScaleType.CENTER_CROP : ImageView.ScaleType.FIT_CENTER);
        }
    });

    return view;
}

From source file:com.yasiradnan.Schedule.ScheduleSlideFragment.java

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

    final ListView list = (ListView) rootView.findViewById(R.id.list);
    BinderData bindingData = new BinderData(this.getActivity(), ScheduleInformation);
    list.setAdapter(bindingData);// w  w w .  j a  v a  2 s.  co m

    list.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            ScheduleItem item = ScheduleInformation[position];

            if (item.getItemType() == 0 || item.getItemType() == 3 || item.getItemType() == 2)
                return;

            Intent intent = new Intent(ScheduleSlideFragment.this.getActivity(), ContentExtended.class);
            intent.putExtra("title", item.getTitle());
            intent.putExtra("content", item.getContent());
            startActivity(intent);
        }
    });

    return rootView;
}

From source file:com.sonymobile.androidapp.gridcomputing.fragments.ConditionsSlidePageFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.condition_detail_item, container, false);
    mImage = (ImageView) rootView.findViewById(R.id.condition_detail_image);
    mTitle = (TextView) rootView.findViewById(R.id.condition_detail_title);
    mText = (TextView) rootView.findViewById(R.id.condition_detail_text);
    return rootView;
}

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

private View createText(LayoutInflater inflater, ViewGroup viewLayout) {
    return inflater.inflate(R.layout.dialog_about_text,
            (ViewGroup) viewLayout.findViewById(android.R.id.tabcontent), false);
}

From source file:com.deveo.android.ProjectTeamFragment.java

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

    if (rootView != null) {
        ListView listView = (ListView) rootView.findViewById(R.id.list_view_events_project_team);
        listView.setAdapter(adapter);/*  w w w .  j a  va 2s  .c o m*/
    }

    return rootView;
}

From source file:com.example.rosem.TravelPlanner.Fragment.SettingFragment.java

@Nullable
@Override//w  w  w  .  ja  v  a2  s.c om
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.setting_layout, container, false);

    logout = (TextView) view.findViewById(R.id.logout);
    TextView license = (TextView) view.findViewById(R.id.license);

    logout.setTypeface(fontType);
    license.setTypeface(fontType);

    logout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            FirebaseAuth auth = FirebaseAuth.getInstance();
            FirebaseUser user = auth.getCurrentUser();
            if (user != null) {
                auth.signOut();
                Toast.makeText(getContext(), getString(R.string.logout_success), Toast.LENGTH_SHORT).show();
                logout.setText(getString(R.string.login));
            } else {
                Intent intent = new Intent(getContext(), SignInActivity.class);
                startActivityForResult(intent, SIGN_IN);

            }

        }
    });
    license.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.license_url)));
            startActivity(intent);
        }
    });

    return view;
}

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

private void setupSwipeRefreshLayout(ViewGroup root) {
    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.announcementsSwipeRefreshLayout);
    swipeRefreshLayout.setColorSchemeResources(R.color.primary, R.color.hacktx_blue);
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override/*ww  w .j a  v a  2s  . c  om*/
        public void onRefresh() {
            getAnnouncements();
        }
    });
    swipeRefreshLayout.post(new Runnable() {
        @Override
        public void run() {
            swipeRefreshLayout.setRefreshing(true);
        }
    });
}

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

@Nullable
@Override/*ww  w. ja  va 2s  .c o m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_scale, container, false);

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

    transitionsContainer.findViewById(R.id.button1).setOnClickListener(new VisibleToggleClickListener() {

        @Override
        protected void changeVisibility(boolean visible) {
            TransitionManager.beginDelayedTransition(transitionsContainer, new Scale());
            text1.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        }

    });

    final TextView text2 = (TextView) transitionsContainer.findViewById(R.id.text2);

    transitionsContainer.findViewById(R.id.button2).setOnClickListener(new VisibleToggleClickListener() {

        @Override
        protected void changeVisibility(boolean visible) {
            TransitionSet set = new TransitionSet().addTransition(new Scale(0.7f)).addTransition(new Fade())
                    .setInterpolator(
                            visible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
            TransitionManager.beginDelayedTransition(transitionsContainer, set);
            text2.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        }

    });

    return view;
}

From source file:org.omni.roadrunner.PowerProfileFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_power_profile, container, false);

    ListView lv = (ListView) root.findViewById(R.id.lv_power_profiles);
    lv.setAdapter(new PowerProfilesAdapter(getActivity()));

    return root;/*ww w  .  j  a v  a2  s  .co m*/
}