Example usage for android.view ViewGroup setLayoutParams

List of usage examples for android.view ViewGroup setLayoutParams

Introduction

In this page you can find the example usage for android.view ViewGroup setLayoutParams.

Prototype

public void setLayoutParams(ViewGroup.LayoutParams params) 

Source Link

Document

Set the layout parameters associated with this view.

Usage

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

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

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // Since we are building a simple navigation, just hide the spinner.
    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mLoadingSpinner.setVisibility(View.GONE);

    return root;/*from w  w w .ja  v  a2  s.  co m*/
}

From source file:tw.idv.gasolin.pycontw2012.ui.TagStreamFragment.java

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

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we
    // are/* w  ww. ja  v a2s.c  om*/
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top
    // of the activity.
    root.setLayoutParams(
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mWebView = (WebView) root.findViewById(R.id.webview);
    mWebView.setWebViewClient(mWebViewClient);

    mWebView.post(new Runnable() {
        public void run() {
            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
            try {
                mWebView.loadUrl(
                        "http://mobile.twitter.com/search?q=" + URLEncoder.encode(mSearchString, "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                Log.e(TAG, "Could not construct the realtime search URL", e);
            }
        }
    });

    return root;
}

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

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

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;//from w  w  w.  j  a v  a 2  s  .c o m
}

From source file:com.heneryh.aquanotes.ui.controllers.OutletsDataFragment.java

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

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    return root;/*from   w ww .ja  v  a 2  s.c  om*/
}

From source file:org.alfresco.mobile.android.application.extension.samsung.pen.SNotePagesDialogFragment.java

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

    getDialog().setTitle(R.string.editor_pages_move);
    getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);

    ViewGroup v = (ViewGroup) inflater.inflate(R.layout.snote_pages, container, false);

    int width = (int) Math.round(UIUtils.getScreenDimension(getActivity())[0] * (Float.parseFloat(
            getResources().getString(android.R.dimen.dialog_min_width_major).replace("%", "")) * 0.01));
    v.setLayoutParams(new LayoutParams(width, LayoutParams.MATCH_PARENT));

    final SeekBar seekbar = ((SeekBar) v.findViewById(R.id.seekbar_pages));
    final TextView tv = ((TextView) v.findViewById(R.id.pages_number));
    tv.setText(String.valueOf(originPageNumber + 1) + " / " + String.valueOf(totalPages));

    seekbar.setMax(totalPages - 1);//from  w  w  w.j  a v  a2s .com
    seekbar.setProgress(originPageNumber);
    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            currentPageNumber = progress + 1;
            tv.setText(String.valueOf(currentPageNumber) + " / " + String.valueOf(totalPages));
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });

    final Button validate = (Button) v.findViewById(R.id.create_document);
    final Button cancel = (Button) v.findViewById(R.id.cancel);

    validate.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            ((SNoteEditorActivity) getActivity()).movePage(currentPageNumber - 1);
            dismiss();
        }
    });

    cancel.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            SNotePagesDialogFragment.this.dismiss();
        }
    });

    return v;
}

From source file:com.google.android.apps.iosched.ui.MapFragment.java

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

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mWebView = (WebView) root.findViewById(R.id.webview);
    mWebView.setWebChromeClient(mWebChromeClient);
    mWebView.setWebViewClient(mWebViewClient);

    mWebView.post(new Runnable() {
        public void run() {
            // Initialize web view
            if (CLEAR_CACHE_ON_LOAD) {
                mWebView.clearCache(true);
            }// w  w w. j a  v a 2 s .c o m

            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
            mWebView.loadUrl(MAP_URL);
            mWebView.addJavascriptInterface(mMapJsiImpl, MAP_JSI_NAME);
        }
    });

    return root;
}

From source file:com.ibox_ucsc.design.ui.MapFragment.java

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

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(
            new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);

    // here I can add the bitmap image of the floor plan 

    mWebView = (WebView) root.findViewById(R.id.webview);
    mWebView.setWebChromeClient(mWebChromeClient);
    mWebView.setWebViewClient(mWebViewClient);

    mWebView.post(new Runnable() {
        public void run() {
            // Initialize web view
            if (CLEAR_CACHE_ON_LOAD) {
                mWebView.clearCache(true);
            }//from www.j av a 2  s .c  o m

            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
            mWebView.loadUrl(MAP_URL);
            mWebView.addJavascriptInterface(mMapJsiImpl, MAP_JSI_NAME);
        }
    });

    return root;
}

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

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mEmptyView = root.findViewById(R.id.empty_list_view);

    return root;//from www .  j a v  a  2  s  .c  o m
}

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

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);

    return root;//from   www.j a v  a 2s  . com
}

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

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

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);

    return root;//from   w  w  w  .  j ava  2 s .c  o  m
}