Example usage for android.widget LinearLayout VERTICAL

List of usage examples for android.widget LinearLayout VERTICAL

Introduction

In this page you can find the example usage for android.widget LinearLayout VERTICAL.

Prototype

int VERTICAL

To view the source code for android.widget LinearLayout VERTICAL.

Click Source Link

Usage

From source file:com.itude.mobile.mobbl.core.controller.util.MBBasicViewController.java

public View addCloseButtonToClosableDialogView(View dialogView, final AlertDialog dialogToCloseOnclick) {
    MBStyleHandler styleHandler = MBViewBuilderFactory.getInstance().getStyleHandler();

    FragmentActivity context = getActivity();
    LinearLayout wrapper = new LinearLayout(context);
    wrapper.setOrientation(LinearLayout.VERTICAL);

    styleHandler.styleDialogCloseButtonWrapper(wrapper);

    LayoutParams prevDialogViewParams = dialogView.getLayoutParams();
    int width = LayoutParams.MATCH_PARENT;
    int height = LayoutParams.MATCH_PARENT;

    if (prevDialogViewParams != null) {
        width = prevDialogViewParams.width;
        height = prevDialogViewParams.height;
    }//from www.  j  av a 2s. c o  m

    LinearLayout.LayoutParams dialogViewParams = new LinearLayout.LayoutParams(width, height);
    dialogView.setLayoutParams(dialogViewParams);
    wrapper.addView(dialogView);

    LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);

    Button closeButton = new Button(context);
    closeButton.setLayoutParams(buttonParams);
    closeButton.setText(MBLocalizationService.getInstance().getTextForKey("Close"));
    styleHandler.styleDialogCloseButton(closeButton);
    closeButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            MBViewManager.getInstance().endDialog(getDialogController().getName(), false);
        }
    });

    wrapper.addView(closeButton);

    return wrapper;
}

From source file:net.mypapit.mobile.myrepeater.DisplayMap.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display_map);
    overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale);

    hashMap = new HashMap<Marker, MapInfoObject>();

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        getActionBar().setDisplayHomeAsUpEnabled(true);
    }/*from  w w w.j av  a 2  s  . c o m*/

    map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();

    if (map == null) {

        // Log.e("Map NULL", "MAP NULL");
        Toast.makeText(this, "Unable to display Map", Toast.LENGTH_SHORT).show();

    } else {

        LatLng latlng = (LatLng) getIntent().getExtras().get("LatLong");

        Repeater xlocation = new Repeater("", new Double[] { latlng.latitude, latlng.longitude });

        rl = RepeaterListActivity.loadData(R.raw.repeaterdata5, this);
        xlocation.calcDistanceAll(rl);
        rl.sort();

        map.setMyLocationEnabled(true);
        map.setOnInfoWindowClickListener(this);
        map.getUiSettings().setZoomControlsEnabled(true);

        AdView mAdView = (AdView) findViewById(R.id.adViewMap);
        mAdView.loadAd(new AdRequest.Builder().build());

        // counter i, for mapping marker with integer
        int i = 0;

        for (Repeater repeater : rl) {

            MarkerOptions marking = new MarkerOptions();
            marking.position(new LatLng(repeater.getLatitude(), repeater.getLongitude()));
            marking.title(repeater.getCallsign() + " - " + repeater.getDownlink() + "MHz (" + repeater.getClub()
                    + ")");

            marking.snippet("Tone: " + repeater.getTone() + " Shift: " + repeater.getShift());

            RepeaterMapInfo rmi = new RepeaterMapInfo(repeater);
            rmi.setIndex(i);

            hashMap.put(map.addMarker(marking), rmi);

            i++;

        }

        // Marker RKG = map.addMarker(new MarkerOptions().position(new
        // LatLng(6.1,100.3)).title("9M4RKG"));

        map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 10));
        map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);

        cache = this.getSharedPreferences(CACHE_PREFS, 0);

        Date cachedate = new Date(cache.getLong(CACHE_TIME, new Date(20000).getTime()));

        long secs = (new Date().getTime() - cachedate.getTime()) / 1000;
        long hours = secs / 3600L;
        secs = secs % 3600L;
        long mins = secs / 60L;

        if (mins < 5) {
            String jsoncache = cache.getString(CACHE_JSON, "none");
            if (jsoncache.compareToIgnoreCase("none") == 0) {
                new GetUserInfo(latlng, this).execute();

            } else {

                loadfromCache(jsoncache);
                // Toast.makeText(this, "Loaded from cache: " + mins +
                // " mins", Toast.LENGTH_SHORT).show();
            }

        } else {

            new GetUserInfo(latlng, this).execute();

        }

        map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

            @Override
            public View getInfoWindow(Marker marker) {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public View getInfoContents(Marker marker) {
                Context context = getApplicationContext(); // or
                // getActivity(),
                // YourActivity.this,
                // etc.

                LinearLayout info = new LinearLayout(context);
                info.setOrientation(LinearLayout.VERTICAL);

                TextView title = new TextView(context);
                title.setTextColor(Color.BLACK);
                title.setGravity(Gravity.CENTER);
                title.setTypeface(null, Typeface.BOLD);
                title.setText(marker.getTitle());

                TextView snippet = new TextView(context);
                snippet.setTextColor(Color.GRAY);
                snippet.setText(marker.getSnippet());

                info.addView(title);
                info.addView(snippet);

                return info;
            }
        });

    }

}

From source file:com.google.android.apps.santatracker.doodles.tilt.SwimmingFragment.java

@Override
protected void firstPassLoadOnUiThread() {
    final FrameLayout.LayoutParams wrapperLP = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);/*from ww  w .j av  a  2  s.  c om*/

    final SwimmingFragment that = this;
    scoreView = getScoreView();
    pauseView = getPauseView();

    int diveViewBottomMargin = (int) context.getResources().getDimension(R.dimen.dive_margin_bottom);
    int diveViewStartMargin = (int) context.getResources().getDimension(R.dimen.dive_margin_left);
    int diveViewSize = (int) context.getResources().getDimension(R.dimen.dive_image_size);

    FrameLayout.LayoutParams diveViewLP = new LayoutParams(diveViewSize, diveViewSize);
    diveViewLP.setMargins(diveViewStartMargin, 0, 0, diveViewBottomMargin);
    diveViewLP.gravity = Gravity.BOTTOM | Gravity.LEFT;

    if (VERSION.SDK_INT >= 17) {
        diveViewLP.setMarginStart(diveViewStartMargin);
    }
    diveView = new DiveView(context);

    countdownView = new TextView(context);
    countdownView.setGravity(Gravity.CENTER);
    countdownView.setTextColor(context.getResources().getColor(R.color.ui_text_yellow));
    countdownView.setTypeface(Typeface.DEFAULT_BOLD);
    countdownView.setText("0");
    countdownView.setVisibility(View.INVISIBLE);
    Locale locale = context.getResources().getConfiguration().locale;
    countdownView.setText(NumberFormat.getInstance(locale).format(3));
    Point screenDimens = AndroidUtils.getScreenSize();
    UIUtil.fitToBounds(countdownView, screenDimens.x / 10, screenDimens.y / 10);

    LinearLayout gameView = new LinearLayout(context);
    gameView.setOrientation(LinearLayout.VERTICAL);

    // Add game view.
    swimmingView = new SwimmingView(context);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT, 7);
    gameView.addView(swimmingView, lp);

    if (editorMode) {
        LinearLayout buttonWrapper = new LinearLayout(context);
        buttonWrapper.setOrientation(LinearLayout.HORIZONTAL);
        lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT, 1);
        gameView.addView(buttonWrapper, lp);

        resetButton = getButton(R.string.reset_level, new OnClickListener() {
            @Override
            public void onClick(View v) {
                SwimmingModel level = levelManager.loadDefaultLevel();
                initializeLevel(level, false);

                getActivity().getSharedPreferences(context.getString(R.string.swimming), Context.MODE_PRIVATE)
                        .edit().putString(CURRENT_LEVEL_KEY, null).commit();
            }
        });
        deleteButton = getButton(R.string.delete_levels, new OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogFragment dialogFragment = new DeleteLevelDialogFragment();
                dialogFragment.show(getActivity().getFragmentManager(), "delete");
            }
        });
        loadButton = getButton(R.string.load_level, new OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogFragment dialogFragment = new LoadLevelDialogFragment(that);
                dialogFragment.show(getActivity().getFragmentManager(), "load");
            }
        });
        saveButton = getButton(R.string.save_level, new OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogFragment dialogFragment = new SaveLevelDialogFragment(that);
                dialogFragment.show(getActivity().getFragmentManager(), "save");
            }
        });
        collisionModeButton = new ToggleButton(context);
        collisionModeButton.setText(R.string.scenery_mode);
        collisionModeButton.setTextOff(context.getString(R.string.scenery_mode));
        collisionModeButton.setTextOn(context.getString(R.string.collision_mode));
        collisionModeButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                model.collisionMode = isChecked;
            }
        });

        lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.MATCH_PARENT, 1);
        buttonWrapper.addView(deleteButton, lp);
        buttonWrapper.addView(resetButton, lp);
        buttonWrapper.addView(loadButton, lp);
        buttonWrapper.addView(saveButton, lp);
        buttonWrapper.addView(collisionModeButton, lp);
    }

    sensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
    accelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    if (accelerometerSensor == null) {
        // TODO: The game won't be playable without this, so what should we do?
        Log.d(TAG, "Accelerometer sensor is null");
    }
    displayRotation = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
            .getRotation();

    wrapper.addView(gameView, 0, wrapperLP);
    wrapper.addView(countdownView, 1);
    wrapper.addView(diveView, 2, diveViewLP);
    wrapper.addView(scoreView, 3);
    wrapper.addView(pauseView, 4);
}

From source file:com.phonegap.DroidGap.java

/** 
 * Called when the activity is first created. 
 * //from  ww w . jav a 2s .  c  om
 * @param savedInstanceState
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

    //getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
    //   WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    // This builds the view.  We could probably get away with NOT having a LinearLayout, but I like having a bucket!

    root = new LinearLayout(this);
    //Disable ScrollBar
    root.setVerticalScrollBarEnabled(false);
    root.setHorizontalScrollBarEnabled(false);
    root.setOrientation(LinearLayout.VERTICAL);
    root.setBackgroundColor(Color.BLACK);
    root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT, 0.0F));

    // If url was passed in to intent, then init webview, which will load the url
    Bundle bundle = this.getIntent().getExtras();
    if (bundle != null) {
        String url = bundle.getString("url");
        if (url != null) {
            this.init();
        }
    }
    // Setup the hardware volume controls to handle volume control
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
}

From source file:org.nativescript.widgets.TabLayout.java

/**
 * Create a default view to be used for tabs.
 *//* w  ww  .j a v a  2s.  co m*/
protected View createDefaultTabView(Context context, TabItemSpec tabItem) {
    float density = getResources().getDisplayMetrics().density;
    int padding = (int) (TAB_VIEW_PADDING_DIPS * density);

    LinearLayout ll = new LinearLayout(context);
    ll.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    ll.setGravity(Gravity.CENTER);
    ll.setOrientation(LinearLayout.VERTICAL);
    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    ll.setBackgroundResource(outValue.resourceId);

    ImageView imgView = new ImageView(context);
    imgView.setScaleType(ScaleType.FIT_CENTER);
    LinearLayout.LayoutParams imgLP = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    imgLP.gravity = Gravity.CENTER;
    imgView.setLayoutParams(imgLP);

    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setMaxWidth((int) (TEXT_MAX_WIDTH * density));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setAllCaps(true);
    textView.setMaxLines(2);
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    textView.setPadding(padding, 0, padding, 0);

    this.setupItem(ll, textView, imgView, tabItem);

    ll.addView(imgView);
    ll.addView(textView);
    return ll;
}

From source file:org.mozilla.gecko.GeckoPreferences.java

protected Dialog onCreateDialog(int id) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    AlertDialog dialog = null;//from  w  w  w.j ava 2s . c o  m
    switch (id) {
    case DIALOG_CREATE_MASTER_PASSWORD:
        final EditText input1 = getTextBox(R.string.masterpassword_password);
        final EditText input2 = getTextBox(R.string.masterpassword_confirm);
        linearLayout.addView(input1);
        linearLayout.addView(input2);

        builder.setTitle(R.string.masterpassword_create_title).setView((View) linearLayout)
                .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        JSONObject jsonPref = new JSONObject();
                        try {
                            jsonPref.put("name", "privacy.masterpassword.enabled");
                            jsonPref.put("type", "string");
                            jsonPref.put("value", input1.getText().toString());

                            GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Set",
                                    jsonPref.toString());
                            GeckoAppShell.sendEventToGecko(event);
                        } catch (Exception ex) {
                            Log.e(LOGTAG, "Error setting masterpassword", ex);
                        }
                        return;
                    }
                }).setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        return;
                    }
                });
        dialog = builder.create();
        dialog.setOnShowListener(new DialogInterface.OnShowListener() {
            public void onShow(DialogInterface dialog) {
                input1.setText("");
                input2.setText("");
                input1.requestFocus();
            }
        });

        PasswordTextWatcher watcher = new PasswordTextWatcher(input1, input2, dialog);
        input1.addTextChangedListener((TextWatcher) watcher);
        input2.addTextChangedListener((TextWatcher) watcher);

        break;
    case DIALOG_REMOVE_MASTER_PASSWORD:
        final EditText input = getTextBox(R.string.masterpassword_password);
        linearLayout.addView(input);

        builder.setTitle(R.string.masterpassword_remove_title).setView((View) linearLayout)
                .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        try {
                            JSONObject jsonPref = new JSONObject();
                            jsonPref.put("name", "privacy.masterpassword.enabled");
                            jsonPref.put("type", "string");
                            jsonPref.put("value", input.getText().toString());

                            GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Set",
                                    jsonPref.toString());
                            GeckoAppShell.sendEventToGecko(event);
                        } catch (Exception ex) {
                            Log.e(LOGTAG, "Error setting masterpassword", ex);
                        }
                        return;
                    }
                }).setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        return;
                    }
                });
        dialog = builder.create();
        dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
            public void onDismiss(DialogInterface dialog) {
                input.setText("");
            }
        });
        break;
    default:
        return null;
    }

    return dialog;
}

From source file:com.sentaroh.android.Utilities.ContextMenu.CustomContextMenuFragment.java

private void initViewWidget() {
    if (DEBUG_ENABLE)
        Log.v(APPLICATION_TAG, "initViewWidget");

    //      CommonDialog.setDlgBoxSizeCompact(mDialog);

    LinearLayout dlg_ll = new LinearLayout(getActivity());
    dlg_ll.setOrientation(LinearLayout.VERTICAL);
    TextView dlg_tv = new TextView(getActivity());
    dlg_tv.setBackgroundColor(Color.WHITE);
    dlg_tv.setTextColor(Color.BLACK);
    //        dlg_tv.setTextSize(32);
    dlg_tv.setGravity(android.view.Gravity.CENTER_VERTICAL | android.view.Gravity.CENTER_HORIZONTAL);

    ListView dlg_lv = new ListView(getActivity());
    dlg_lv.setBackgroundColor(Color.WHITE);

    dlg_ll.addView(dlg_tv);/*w w w.j a  va2  s . c o m*/
    dlg_ll.addView(dlg_lv);

    mDialog.setContentView(dlg_ll);

    if (mDialogTitle.length() != 0) {
        dlg_tv.setText(mDialogTitle);
        dlg_tv.setVisibility(TextView.VISIBLE);
    } else
        dlg_tv.setVisibility(TextView.GONE);

    dlg_lv.setAdapter(mMenuAdapter);
    dlg_lv.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> items, View view, int idx, long id) {
            CustomContextMenuItem item = (CustomContextMenuItem) mMenuAdapter.getItem(idx);
            if (item.menu_enabled) {
                if (idx < mClickHandler.size()) {
                    mClickHandler.get(idx).onClick(item.text);
                }
                mFragment.dismiss();
            }
        }
    });
    dlg_lv.setScrollingCacheEnabled(false);
    dlg_lv.setScrollbarFadingEnabled(false);
    //      int[] colors = {0, 0xFFFF0000, 0}; // red for the example
    //      lv.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
    dlg_lv.setDividerHeight(0);

}

From source file:mobisocial.musubi.ui.fragments.AccountLinkDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LinearLayout window = new LinearLayout(mActivity);
    window.setLayoutParams(CommonLayouts.FULL_SCREEN);
    window.setOrientation(LinearLayout.VERTICAL);

    LinearLayout socialBox = new LinearLayout(mActivity);
    socialBox.setLayoutParams(CommonLayouts.FULL_WIDTH);
    socialBox.setOrientation(LinearLayout.HORIZONTAL);
    socialBox.setWeightSum(1.0f * DISPLAYED_SERVICES);

    /** Google **/
    ImageButton google = new ImageButton(mActivity);
    google.setImageResource(R.drawable.google);
    google.setOnClickListener(mGoogleClickListener);
    google.setLayoutParams(/* ww  w  . j a v  a 2  s .  com*/
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f));
    google.setAdjustViewBounds(true);
    socialBox.addView(google);

    /** Facebook **/
    ImageButton facebook = new ImageButton(mActivity);
    facebook.setImageResource(R.drawable.facebook);
    facebook.setOnClickListener(mFacebookClickListener);
    facebook.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f));
    facebook.setAdjustViewBounds(true);
    socialBox.addView(facebook);

    /** Phone Number **/
    ImageButton phone = new ImageButton(mActivity);
    phone.setImageResource(R.drawable.phone);
    phone.setOnClickListener(mPhoneClickListener);
    phone.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f));
    phone.setAdjustViewBounds(true);
    //socialBox.addView(phone);

    /** List of known accounts **/
    TextView chooseService = new TextView(mActivity);
    chooseService.setText("Choose a service to connect.");
    chooseService.setVisibility(View.GONE);
    chooseService.setLayoutParams(CommonLayouts.FULL_SCREEN);
    chooseService.setTextSize(20);
    mAccountAdapter = new AccountAdapter(getActivity());
    mAccountList = new ListView(getActivity());
    mAccountList.setAdapter(mAccountAdapter);
    mAccountList.setPadding(6, 10, 6, 0);
    mAccountList.setLayoutParams(CommonLayouts.FULL_SCREEN);
    mAccountList.setEmptyView(chooseService);

    /** Put it together **/
    window.addView(socialBox);
    window.addView(mAccountList);
    window.addView(chooseService);

    initialize();

    return window;
}

From source file:com.example.mapsample.view.ActionSheet.java

private View createView() {
    FrameLayout parent = new FrameLayout(getActivity());
    parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT));
    mBg = new View(getActivity());
    mBg.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.MATCH_PARENT));
    mBg.setBackgroundColor(Color.argb(136, 0, 0, 0));
    mBg.setId(ActionSheet.BG_VIEW_ID);//from www  . j a  v  a  2s. c  o  m
    mBg.setOnClickListener(this);

    mPanel = new LinearLayout(getActivity());
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.BOTTOM;
    mPanel.setLayoutParams(params);
    mPanel.setOrientation(LinearLayout.VERTICAL);
    parent.setPadding(0, 0, 0, getNavBarHeight(getActivity()));
    parent.addView(mBg);
    parent.addView(mPanel);
    return parent;
}

From source file:com.photon.phresco.nativeapp.eshop.activity.PhrescoActivity.java

/**
 * Make a standard toast that just contains a text view with the text from a
 * resource, for long time// w  ww.  j  av  a 2s  .  co m
 *
 * @param str
 *            The resource id of the string resource to use. Can be
 *            formatted text.
 */
public void toast(int str) {
    Toast toast = Toast.makeText(this, str, Toast.LENGTH_LONG);
    toast.setGravity(LinearLayout.VERTICAL, 0, 0);
    toast.show();
}