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:org.hedgewars.hedgeroid.LobbyActivity.java

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    setContentView(R.layout.activity_lobby);
    ChatFragment chatFragment = (ChatFragment) getSupportFragmentManager().findFragmentById(R.id.chatFragment);
    chatFragment.setInRoom(false);/* www.  j  a  v  a2  s .c o m*/

    FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
    trans.add(new NetplayStateFragment(), "netplayFragment");
    trans.commit();

    netplay = Netplay.getAppInstance(getApplicationContext());

    // Set up a tabbed UI for medium and small screens
    tabHost = (TabHost) findViewById(android.R.id.tabhost);
    if (tabHost != null) {
        tabHost.setup();
        tabHost.getTabWidget().setOrientation(LinearLayout.VERTICAL);

        tabHost.addTab(tabHost
                .newTabSpec("rooms").setIndicator(UiUtils.createVerticalTabIndicator(tabHost,
                        R.string.lobby_tab_rooms, R.drawable.roomlist_ingame))
                .setContent(R.id.roomListFragment));
        tabHost.addTab(tabHost.newTabSpec("chat")
                .setIndicator(
                        UiUtils.createVerticalTabIndicator(tabHost, R.string.lobby_tab_chat, R.drawable.edit))
                .setContent(R.id.chatFragment));
        tabHost.addTab(tabHost.newTabSpec("players").setIndicator(
                UiUtils.createVerticalTabIndicator(tabHost, R.string.lobby_tab_players, R.drawable.human))
                .setContent(R.id.playerListFragment));

        if (icicle != null) {
            tabHost.setCurrentTabByTag(icicle.getString("currentTab"));
        }
    }
}

From source file:com.clov4r.moboplayer.android.nil.codec.activity.MoboThumbnailTestActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    imageView = new ImageView(this);
    SubtitleJni h = new SubtitleJni();
    String libpath = getFilesDir().getParent() + "/lib/";
    String libname = "libffmpeg.so";// libffmpeg_armv7_neon.so
    h.loadFFmpegLibs(libpath, libname);//w  w  w  .  ja  va  2  s .  c  o  m

    Button button = new Button(this);
    layout.addView(button);
    layout.addView(imageView);
    button.setText("");
    setContentView(layout);
    button.setOnClickListener(mOnClickListener);

}

From source file:com.nextgis.mobile.map.LocalGeoJsonLayer.java

protected static void showPropertiesDialog(final MapBase map, final boolean bCreate, String layerName,
        final Uri uri, final LocalGeoJsonLayer layer) {
    final LinearLayout linearLayout = new LinearLayout(map.getContext());
    final EditText input = new EditText(map.getContext());
    input.setText(layerName);/*w  w  w . j  a  v  a  2 s  . c  o m*/

    final TextView stLayerName = new TextView(map.getContext());
    stLayerName.setText(map.getContext().getString(R.string.layer_name) + ":");

    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.addView(stLayerName);
    linearLayout.addView(input);

    if (!bCreate) {
        //TODO: style for drawing
    }

    new AlertDialog.Builder(map.getContext())
            .setTitle(bCreate ? R.string.input_layer_properties : R.string.change_layer_properties)
            //                                    .setMessage(message)
            .setView(linearLayout).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    if (bCreate) {
                        create(map, input.getText().toString(), uri);
                    } else {
                        layer.setName(input.getText().toString());
                        map.onLayerChanged(layer);
                    }
                }
            }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    // Do nothing.
                    Toast.makeText(map.getContext(), R.string.error_cancel_by_user, Toast.LENGTH_SHORT).show();
                }
            }).show();
}

From source file:com.cerema.cloud2.ui.dialog.CredentialsDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    // Create field for username
    mUsernameET = new EditText(getActivity());
    mUsernameET.setHint(getActivity().getText(R.string.auth_username));

    // Create field for password
    mPasswordET = new EditText(getActivity());
    mPasswordET.setHint(getActivity().getText(R.string.auth_password));
    mPasswordET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    // Prepare LinearLayout for dialog
    LinearLayout ll = new LinearLayout(getActivity());
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.addView(mUsernameET);//from  www. j  a va  2 s. c o m
    ll.addView(mPasswordET);

    ll.requestFocus();

    setRetainInstance(true);

    Builder authDialog = new AlertDialog.Builder(getActivity())
            .setTitle(getActivity().getText(R.string.saml_authentication_required_text)).setView(ll)
            .setCancelable(false).setPositiveButton(R.string.common_ok, this)
            .setNegativeButton(R.string.common_cancel, this);

    Dialog d = authDialog.create();
    d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    return d;
}

From source file:com.everyplay.android.everyplayrecord.EveryplayRecordActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Create a GLSurfaceView instance and set it
    // as the ContentView for this Activity
    mGLView = new EveryplayRecordSurfaceView(this);
    setContentView(mGLView);//from   w w w .j a v  a  2  s .c om

    buttons = new LinearLayout(this);
    buttons.setOrientation(LinearLayout.VERTICAL);
    if (!USE_EVERYPLAY_AUDIO_BOARD) {
        addButton("Everyplay", "everyplay");
        addButton("Start recording", "rec");
        Button playLastRecording = addButton("Play last recording", "play_last_recording");
        playLastRecording.setVisibility(View.GONE);

        addButton("Test video playback", "test_video_playback");
        addButton("Show sharing modal", "sharing_modal");

        Button hudRecord = addButton("HUD record off", "hud_record");
        hudRecord.setVisibility(View.GONE);

        stream1 = new EveryplayRecordAudioGenerator(5);
        stream1.play();
        streamActive = stream1;
    } else {
        addButton("Play song #1", "play1_a");
        addButton("Unload song #1", "unload1_a");
        addButton("Pause song", "pause_a");
        addButton("Resume song", "resume_a");
        addButton("Rewind song", "rewind_a");
        addButton("Stop song", "stop_a");

        this.addContentView(buttons, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));
        buttons = new LinearLayout(this);
        buttons.setOrientation(LinearLayout.VERTICAL);
        buttons.setX(400);

        addButton("Play song #2", "play2_a");
        addButton("Unload song #2", "unload2_a");
        addButton("Effect #1", "effect1_a");
        addButton("Effect #2", "effect2_a");
        addButton("Start recording", "rec");
        addButton("Play last recording", "play_last_recording");

        soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
        sound_pew = soundPool.load(this, R.raw.pew, 1);
        sound_pow = soundPool.load(this, R.raw.pow, 1);
    }

    this.addContentView(buttons, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));

    init();
}

From source file:eu.geopaparazzi.library.forms.views.GTimeView.java

/**
 * @param fragment the fragment./*from   w ww. ja va 2  s  . c o m*/
 * @param attrs attributes.
 * @param parentView parent
 * @param key key
 * @param value value
 * @param constraintDescription constraints
 * @param readonly if <code>false</code>, the item is disabled for editing.
 */
public GTimeView(final Fragment fragment, AttributeSet attrs, LinearLayout parentView, String key, String value,
        String constraintDescription, boolean readonly) {
    super(fragment.getActivity(), attrs);

    Context context = fragment.getActivity();

    LinearLayout textLayout = new LinearLayout(context);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 10, 10, 10);
    textLayout.setLayoutParams(layoutParams);
    textLayout.setOrientation(LinearLayout.VERTICAL);
    parentView.addView(textLayout);

    TextView textView = new TextView(context);
    textView.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    textView.setPadding(2, 2, 2, 2);
    textView.setText(key.replace(UNDERSCORE, " ").replace(COLON, " ") + " " + constraintDescription);
    textView.setTextColor(context.getResources().getColor(R.color.formcolor));
    textLayout.addView(textView);

    button = new Button(context);
    button.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    button.setPadding(15, 5, 15, 5);

    final SimpleDateFormat timeFormatter = TimeUtilities.INSTANCE.TIMEONLY_FORMATTER;
    if (value == null || value.length() == 0) {
        String dateStr = timeFormatter.format(new Date());
        button.setText(dateStr);
    } else {
        button.setText(value);
    }
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            String dateStr = button.getText().toString();
            Date date = null;
            try {
                date = timeFormatter.parse(dateStr);
            } catch (ParseException e) {
                // fallback on current date
                date = new Date();
            }
            final Calendar c = Calendar.getInstance();
            c.setTime(date);
            int hourOfDay = c.get(Calendar.HOUR_OF_DAY);
            int minute = c.get(Calendar.MINUTE);

            FormTimePickerFragment newFragment = new FormTimePickerFragment();
            newFragment.setAttributes(hourOfDay, minute, true, button);
            newFragment.show(fragment.getFragmentManager(), "timePicker");
        }
    });
    button.setEnabled(!readonly);

    textLayout.addView(button);
}

From source file:eu.geopaparazzi.library.forms.views.GDateView.java

/**
 * @param fragment   the fragment to use.
 * @param attrs attributes./* w w  w. ja  v a 2  s  .c o  m*/
 * @param parentView parent
 * @param key key
 * @param value value
 * @param constraintDescription constraints
 * @param readonly if <code>false</code>, the item is disabled for editing.
 */
public GDateView(final Fragment fragment, AttributeSet attrs, LinearLayout parentView, String key, String value,
        String constraintDescription, boolean readonly) {
    super(fragment.getActivity(), attrs);

    Context context = fragment.getActivity();

    LinearLayout textLayout = new LinearLayout(context);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 10, 10, 10);
    textLayout.setLayoutParams(layoutParams);
    textLayout.setOrientation(LinearLayout.VERTICAL);
    parentView.addView(textLayout);

    TextView textView = new TextView(context);
    textView.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    textView.setPadding(2, 2, 2, 2);
    textView.setText(key.replace(UNDERSCORE, " ").replace(COLON, " ") + " " + constraintDescription);
    textView.setTextColor(context.getResources().getColor(R.color.formcolor));
    textLayout.addView(textView);

    button = new Button(context);
    button.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    button.setPadding(15, 5, 15, 5);

    final SimpleDateFormat dateFormatter = TimeUtilities.INSTANCE.DATEONLY_FORMATTER;
    if (value == null || value.length() == 0) {
        String dateStr = dateFormatter.format(new Date());
        button.setText(dateStr);
    } else {
        button.setText(value);
    }
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            String dateStr = button.getText().toString();
            Date date = null;
            try {
                date = dateFormatter.parse(dateStr);
            } catch (ParseException e) {
                // fallback on current date
                date = new Date();
            }
            final Calendar c = Calendar.getInstance();
            c.setTime(date);
            int year = c.get(Calendar.YEAR);
            int month = c.get(Calendar.MONTH);
            int day = c.get(Calendar.DAY_OF_MONTH);

            FormDatePickerFragment newFragment = new FormDatePickerFragment(year, month, day, button);
            newFragment.show(fragment.getFragmentManager(), "datePicker");
        }
    });
    button.setEnabled(!readonly);

    textLayout.addView(button);
}

From source file:com.lillicoder.demo.carouselview.widget.CarouselView.java

/**
 * Inflates and initializes this view.//from w w w .j a v a 2s .  c  om
 * @param context {@link Context} for this view.
 * @param attrs {@link AttributeSet} for this view.
 * @param defStyle Optional default style for this view.
 */
private void initialize(Context context, AttributeSet attrs, int defStyle) {
    setOrientation(LinearLayout.VERTICAL);

    LayoutInflater inflater = LayoutInflater.from(context);
    inflater.inflate(R.layout.view_carousel, this);

    mViewPager = (ViewPager) findViewById(R.id.CarouselView_viewPager);
    mIndicatorContainer = (ViewGroup) findViewById(R.id.CarouselView_indicatorContainer);

    if (attrs != null) {
        TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.CarouselView, defStyle, 0);
        Resources resources = getResources();

        mIndicatorDrawableResourceId = attributes.getResourceId(R.styleable.CarouselView_indicator,
                R.drawable.carousel_indicator);
        mIndicatorPadding = (int) attributes.getDimension(R.styleable.CarouselView_indicatorPadding,
                resources.getDimension(R.dimen.indicator_padding));
    }

    mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrollStateChanged(int state) {
        }

        @Override
        public void onPageScrolled(int position, float floatOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            int childCount = mIndicatorContainer.getChildCount();
            for (int childPosition = 0; childPosition < childCount; childPosition++) {
                Checkable child = (Checkable) mIndicatorContainer.getChildAt(childPosition);
                if (child != null) {
                    child.setChecked(childPosition == position);
                }
            }
        }
    });
}

From source file:com.github.capone.controller.favorites.FavoritesFragment.java

@Override
public void onClick(View v) {
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    final EditText name = new EditText(getActivity());
    name.setHint(R.string.server_name);/*from  ww  w.  j av a 2 s. c  o m*/
    final EditText address = new EditText(getActivity());
    address.setHint(R.string.server_address);
    final EditText publicKey = new EditText(getActivity());
    publicKey.setHint(R.string.public_key);

    LinearLayout layout = new LinearLayout(getActivity());
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.addView(name, params);
    layout.addView(address, params);
    layout.addView(publicKey, params);

    new AlertDialog.Builder(getActivity()).setTitle(R.string.title_add_favorite)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    addServer(name.getText().toString(), address.getText().toString(),
                            publicKey.getText().toString());
                }
            }).setView(layout).show();
}

From source file:br.org.funcate.dynamicforms.views.GTimeView.java

/**
 * @param fragment the fragment.//  w  w  w. jav  a 2  s  . co m
 * @param attrs attributes.
 * @param parentView parent
 * @param label label
 * @param value value
 * @param constraintDescription constraints
 * @param readonly if <code>false</code>, the item is disabled for editing.
 */
public GTimeView(final Fragment fragment, AttributeSet attrs, LinearLayout parentView, String label,
        String value, String constraintDescription, boolean readonly) {
    super(fragment.getActivity(), attrs);

    final Context context = fragment.getActivity();

    LinearLayout textLayout = new LinearLayout(context);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 10, 10, 10);
    textLayout.setLayoutParams(layoutParams);
    textLayout.setOrientation(LinearLayout.VERTICAL);
    parentView.addView(textLayout);

    TextView textView = new TextView(context);
    textView.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    textView.setPadding(2, 2, 2, 2);
    textView.setText(label.replace(UNDERSCORE, " ").replace(COLON, " ") + " " + constraintDescription);
    textView.setTextColor(context.getResources().getColor(R.color.formcolor));
    textLayout.addView(textView);

    button = new Button(context);
    button.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    button.setPadding(15, 5, 15, 5);

    final SimpleDateFormat timeFormatter = TimeUtilities.INSTANCE.TIMEONLY_FORMATTER;
    if (value == null || value.length() == 0) {
        String dateStr = timeFormatter.format(new Date());
        button.setText(dateStr);
    } else {
        button.setText(value);
    }
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            String dateStr = button.getText().toString();
            Date date = null;
            try {
                date = timeFormatter.parse(dateStr);
            } catch (ParseException e) {
                //GPLog.error(this, null, e);
                Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
                // fallback on current date
                date = new Date();
            }
            final Calendar c = Calendar.getInstance();
            c.setTime(date);
            int hourOfDay = c.get(Calendar.HOUR_OF_DAY);
            int minute = c.get(Calendar.MINUTE);

            FormTimePickerFragment newFragment = new FormTimePickerFragment();
            newFragment.setAttributes(hourOfDay, minute, true, button);
            //newFragment.show(fragment.getFragmentManager(), "timePicker");
        }
    });
    button.setEnabled(!readonly);

    textLayout.addView(button);
}