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.ymt.demo1.baseClasses.SimpleTestTabFragmentScrollUltraListViewFragment.java

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

    scrollView = (ObservableScrollView) view.findViewById(R.id.scroll);
    Fragment parentFragment = getParentFragment();
    ViewGroup viewGroup = (ViewGroup) parentFragment.getView();
    if (viewGroup != null) {
        scrollView.setTouchInterceptionViewGroup((ViewGroup) viewGroup.findViewById(R.id.container));
        if (parentFragment instanceof ObservableScrollViewCallbacks) {
            scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentFragment);
        }//from   ww  w.  j a  v  a 2s  . c om
    }

    initView(view);
    return view;
}

From source file:com.fugueweb.pub.animation.ScreenSlidePageFragment.java

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

    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));

    switch (mPageNumber) {
    case 0:// w  w  w .  j  a v  a 2s . c  om
        rootView.findViewById(R.id.lorem_ipsum1).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.lorem_ipsum2).setVisibility(View.GONE);
        rootView.findViewById(R.id.lorem_ipsum3).setVisibility(View.GONE);
        break;
    case 1:
        rootView.findViewById(R.id.lorem_ipsum1).setVisibility(View.GONE);
        rootView.findViewById(R.id.lorem_ipsum2).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.lorem_ipsum3).setVisibility(View.GONE);
        break;
    case 2:
        rootView.findViewById(R.id.lorem_ipsum1).setVisibility(View.GONE);
        rootView.findViewById(R.id.lorem_ipsum2).setVisibility(View.GONE);
        rootView.findViewById(R.id.lorem_ipsum3).setVisibility(View.VISIBLE);
        break;
    }

    return rootView;
}

From source file:com.example.administrator.animex.ScreenSlidePageFragment.java

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

    rootView.setBackgroundColor(color);/*  w  w w  . j  a  v  a 2 s  .com*/
    // Set the title view to show the page number.
    ((TextView) rootView.findViewById(R.id.text1)).setText("" + mPageNumber);

    return rootView;
}

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

@SuppressLint("InflateParams")
@Override/*from  w  w  w  .j  a  va  2 s .  c om*/
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);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        listview.setFastScrollAlwaysVisible(true);
    }
    if (controller.getServer() != null) {
        ArrayList<String> list = new ArrayList<String>();
        for (Album a : controller.getAlbums()) {
            list.add(a.toString());
        }
        AlbumArrayAdapter adapter = new AlbumArrayAdapter(getActivity().getApplicationContext(), list,
                controller.getAlbums());
        listview.setAdapter(adapter);
        registerForContextMenu(listview);

        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
                Album a = controller.getAlbums().get(position);
                controller.getSelectedSongs().clear();
                for (Song s : controller.findSongs(a)) {
                    controller.getSelectedSongs().add(s);
                }
                // Create new fragment and transaction
                SelectedSongsView newFragment = new SelectedSongsView();
                FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();

                // Replace whatever is in the fragment_container view with this fragment,
                // and add the transaction to the back stack
                transaction.replace(R.id.content_frame, newFragment);
                transaction.addToBackStack(null);
                ((MainActivity) getActivity()).setActiveFragment(6);
                // Commit the transaction
                transaction.commit();
            }

        });
    }
    return root;
}

From source file:cn.figo.mydemo.ui.fragment.TracksFragment.java

@Nullable
@Override/*w w  w.  j a  v  a  2  s  .  c o  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_track_list, container, false);
    mTrackListView = (ListView) viewGroup.findViewById(R.id.track_list_view);
    return viewGroup;
}

From source file:com.test.shopping.view.ProductDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    /*/*ww w  .  j  a  v  a 2 s. co m*/
     * Inflate the layout based on the current product details.
     * Fetch the product associated with the current position in product id list
     */
    ProductDataModel product = CacheUtil.getInstance(getActivity()).getProduct(mPosition);

    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.product_detail, container, false);

    TextView productName = (TextView) rootView.findViewById(R.id.product_name);
    productName.setText(StringEscapeUtils.unescapeJava(product.getProductName()));

    String longDes = product.getLongDescription();
    TextView longDescLabel = (TextView) rootView.findViewById(R.id.long_description_label);
    TextView longDesc = (TextView) rootView.findViewById(R.id.long_description);
    if (longDes != null && longDes.length() > 0) {
        longDesc.setText(Jsoup.clean(longDes, Whitelist.simpleText()));
        longDesc.setVisibility(View.VISIBLE);
        longDescLabel.setVisibility(View.VISIBLE);
    } else {
        longDesc.setVisibility(View.INVISIBLE);
        longDescLabel.setVisibility(View.INVISIBLE);
    }

    TextView price = (TextView) rootView.findViewById(R.id.price);
    price.setText(product.getPrice());

    ImageView imageView = (ImageView) rootView.findViewById(R.id.image);
    ImageLoader loader = ConnectionUtil.getInstance(sContext).getImageLoader();
    loader.get(product.getProductImage(),
            ImageLoader.getImageListener(imageView, R.mipmap.ic_launcher, R.mipmap.ic_launcher));

    TextView ratingCountView = (TextView) rootView.findViewById(R.id.rating_count);

    ratingCountView.setText("(" + String.valueOf(product.getReviewCount() + ")"));

    RatingBar bar = (RatingBar) rootView.findViewById(R.id.ratingBar);

    bar.setRating((int) product.getReviewRating());
    bar.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

    TextView inStock = (TextView) rootView.findViewById(R.id.inStock);
    if (product.isInStock()) {
        inStock.setTextColor(getResources().getColor(android.R.color.holo_green_dark));
        inStock.setText(R.string.in_stock_label);
    } else {
        inStock.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
        inStock.setText(R.string.out_of_stock_label);
    }

    return rootView;
}

From source file:angeloid.sopiane.vegaphoneinfo.Tab_Racer1_Main.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.tab_racer1, null);
    backup = (Button) root.findViewById(R.id.tab_racer_backup);
    restore = (Button) root.findViewById(R.id.tab_racer_restore);
    racer_info1 = (TextView) root.findViewById(R.id.tab_racer_subject);
    racer_info2 = (TextView) root.findViewById(R.id.tab_racer_device);
    racer_info3 = (TextView) root.findViewById(R.id.tab_racer_partinfo);
    racer_backup_info = (ImageView) root.findViewById(R.id.racer_backup_info);
    backup.setTypeface(Tab_MainActivity.Fonts.THEOREM);
    restore.setTypeface(Tab_MainActivity.Fonts.THEOREM);
    racer_info1.setTypeface(Tab_MainActivity.Fonts.THEOREM);
    racer_info2.setTypeface(Tab_MainActivity.Fonts.THEOREM);
    racer_info3.setTypeface(Tab_MainActivity.Fonts.THEOREM);
    if (new File("/sdcard/imeibackup/imei.img").exists()) {
        racer_backup_info.setImageResource(R.drawable.apply);
        backup.setEnabled(false);/*from  w  ww  .  j  a  va2s .c o  m*/
        backup.setFocusable(false);

    } else {

        racer_backup_info.setImageResource(R.drawable.not_apply);
        restore.setEnabled(false);
        restore.setFocusable(false);

    }
    backup.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO
            v.postDelayed(new Runnable() {
                public void run() {
                    DialogProgressbackup(false);
                }
            }, 10); // 0.01      
        }
    });
    restore.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO
            v.postDelayed(new Runnable() {
                public void run() {
                    DialogProgressrestore(false);
                }
            }, 10); // 0.01      
        }
    });
    return root;
}

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

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

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

    // Views// w  ww.  java  2  s . c  o  m
    TextView txtPublishDate = (TextView) view.findViewById(R.id.txtDateValue);
    TextView txtAuthor = (TextView) view.findViewById(R.id.txtUsernameValue);
    TextView txtTags = (TextView) view.findViewById(R.id.txtTagsValue);
    ImageView imv = (ImageView) view.findViewById(R.id.imvDetails);

    txtPublishDate.setText(formatearFecha(publishDate));
    txtAuthor.setText(author);
    txtTags.setText(tags);
    imv.setImageURI(Uri.fromFile(new File(imagePath)));
    imv.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            final Activity act = ImageDetailsFragment.this.getActivity();
            Intent in = new Intent(act, HTMLViewer.class);
            Bundle b = new Bundle();
            b.putString(HTMLViewer.KEY_USERNAME, author);
            b.putString(HTMLViewer.KEY_URL_IMAGE, urlDowloadImage);
            in.putExtras(b);
            act.startActivity(in);
        }

    });

    return view;
}

From source file:es.ubiqua.atractivas.ArticlePageFragment.java

protected void createLigAdView(final int aPlacementId, ViewGroup rootView) {
    final LigAdView ligAdView = (LigAdView) rootView.findViewById(R.id.ligAdView);
    ligAdView.fillLigAdView(getActivity(), aPlacementId);
}

From source file:net.abcdroid.devfest12.ui.VendorDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_vendor_detail, null);
    mName = (TextView) rootView.findViewById(R.id.vendor_name);
    mLogo = (ImageView) rootView.findViewById(R.id.vendor_logo);
    mUrl = (TextView) rootView.findViewById(R.id.vendor_url);
    mDesc = (TextView) rootView.findViewById(R.id.vendor_desc);
    return rootView;
}