List of usage examples for android.widget LinearLayout VERTICAL
int VERTICAL
To view the source code for android.widget LinearLayout VERTICAL.
Click Source Link
From source file:org.mariotaku.twidere.activity.SignInActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { requestSupportWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE); mResolver = getContentResolver();/*from w w w . j av a 2 s . c o m*/ mApplication = TwidereApplication.getInstance(this); setContentView(R.layout.sign_in); setSupportProgressBarIndeterminateVisibility(false); final long[] account_ids = getActivatedAccountIds(this); getSupportActionBar().setDisplayHomeAsUpEnabled(account_ids.length > 0); Bundle bundle = savedInstanceState == null ? getIntent().getExtras() : savedInstanceState; if (bundle == null) { bundle = new Bundle(); } mRESTBaseURL = bundle.getString(Accounts.REST_BASE_URL); mOAuthBaseURL = bundle.getString(Accounts.OAUTH_BASE_URL); mSigningRESTBaseURL = bundle.getString(Accounts.SIGNING_REST_BASE_URL); mSigningOAuthBaseURL = bundle.getString(Accounts.SIGNING_OAUTH_BASE_URL); if (isEmpty(mRESTBaseURL)) { mRESTBaseURL = DEFAULT_REST_BASE_URL; } if (isEmpty(mOAuthBaseURL)) { mOAuthBaseURL = DEFAULT_OAUTH_BASE_URL; } if (isEmpty(mSigningRESTBaseURL)) { mSigningRESTBaseURL = DEFAULT_SIGNING_REST_BASE_URL; } if (isEmpty(mSigningOAuthBaseURL)) { mSigningOAuthBaseURL = DEFAULT_SIGNING_OAUTH_BASE_URL; } mUsername = bundle.getString(Accounts.SCREEN_NAME); mPassword = bundle.getString(Accounts.PASSWORD); mAuthType = bundle.getInt(Accounts.AUTH_TYPE); if (bundle.containsKey(Accounts.USER_COLOR)) { mUserColor = bundle.getInt(Accounts.USER_COLOR, Color.TRANSPARENT); } mUsernamePasswordContainer .setVisibility(mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE ? View.GONE : View.VISIBLE); mSigninSignupContainer.setOrientation( mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL); mEditUsername.setText(mUsername); mEditUsername.addTextChangedListener(this); mEditPassword.setText(mPassword); mEditPassword.addTextChangedListener(this); setSignInButton(); setUserColorButton(); if (!mPreferences.getBoolean(PREFERENCE_KEY_API_UPGRADE_CONFIRMED, false)) { final FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentByTag(FRAGMENT_TAG_API_UPGRADE_NOTICE) == null || !fm.findFragmentByTag(FRAGMENT_TAG_API_UPGRADE_NOTICE).isAdded()) { new APIUpgradeConfirmDialog().show(getSupportFragmentManager(), "api_upgrade_notice"); } } }
From source file:com.krayzk9s.imgurholo.ui.MessagingFragment.java
private void buildSendMessage(String username) { ImgurHoloActivity activity = (ImgurHoloActivity) getActivity(); final EditText newUsername = new EditText(activity); newUsername.setSingleLine();/*from w w w .j a va2 s. c om*/ newUsername.setHint(R.string.body_hint_recipient); if (username != null) newUsername.setText(username); final EditText newBody = new EditText(activity); newBody.setHint(R.string.body_hint_body); newBody.setLines(5); LinearLayout linearLayout = new LinearLayout(activity); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(newUsername); linearLayout.addView(newBody); new AlertDialog.Builder(activity).setTitle(R.string.dialog_send_message_title).setView(linearLayout) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { MessagingAsync messagingAsync = new MessagingAsync(newBody.getText().toString(), newUsername.getText().toString()); messagingAsync.execute(); } }).setNegativeButton(R.string.dialog_answer_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Do nothing. } }).show(); }
From source file:bruce.kk.brucetodos.MainActivity.java
/** * ???//from w w w .j a va 2s . co m * * @param position */ private void modifyItem(final int position) { final UnFinishItem item = dataList.get(position); LogDetails.d(item); LinearLayout linearLayout = new LinearLayout(MainActivity.this); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); linearLayout.setLayoutParams(layoutParams); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.setBackgroundColor(getResources().getColor(android.R.color.black)); final EditText editText = new EditText(MainActivity.this); editText.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); editText.setTextColor(getResources().getColor(android.R.color.holo_green_light)); editText.setHint(item.content); editText.setHintTextColor(getResources().getColor(android.R.color.holo_orange_dark)); linearLayout.addView(editText); Button btnModify = new Button(MainActivity.this); btnModify.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); btnModify.setText(""); btnModify.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); btnModify.setTextColor(getResources().getColor(android.R.color.holo_blue_bright)); btnModify.setBackgroundColor(getResources().getColor(android.R.color.black)); linearLayout.addView(btnModify); Button btnDeleteItem = new Button(MainActivity.this); btnDeleteItem.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); btnDeleteItem.setText(""); btnDeleteItem.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); btnDeleteItem.setTextColor(getResources().getColor(android.R.color.holo_blue_bright)); btnDeleteItem.setBackgroundColor(getResources().getColor(android.R.color.black)); linearLayout.addView(btnDeleteItem); final PopupWindow popupWindow = new PopupWindow(linearLayout, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setBackgroundDrawable(new BitmapDrawable()); // ? popupWindow.setTouchable(true); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(contentMain, Gravity.CENTER, 0, 0); btnModify.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LogDetails.d(": " + editText.getText().toString()); if (!TextUtils.isEmpty(editText.getText().toString().trim())) { Date date = new Date(); item.content = editText.getText().toString().trim(); item.modifyDay = date; item.finishDay = null; ProgressDialogUtils.showProgressDialog(); presenter.modifyItem(item); dataList.set(position, item); refreshData(true); popupWindow.dismiss(); } else { Toast.makeText(MainActivity.this, "~", Toast.LENGTH_SHORT).show(); } } }); btnDeleteItem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dataList.remove(position); presenter.deleteItem(item); refreshData(false); popupWindow.dismiss(); } }); }
From source file:com.pressurelabs.flowopensource.TheHubActivity.java
private AlertDialog.Builder generateCustomDialog(EditText nameInputET) { AlertDialog.Builder newFlowDialog = new AlertDialog.Builder(TheHubActivity.this); //Sets up Layout Parameters LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); params.setMarginStart(42);//w w w .j a va 2 s .c o m params.setMarginEnd(50); AppUtils.setNameInputFilters(nameInputET); //Adds the ET and params to the layout of the dialog box layout.addView(nameInputET, params); newFlowDialog.setTitle("Name your new Flow."); newFlowDialog.setView(layout); return newFlowDialog; }
From source file:ca.appvelopers.mcgillmobile.ui.ScheduleActivity.java
/** * Renders the landscape view//from ww w . j av a2s . c om */ private void renderLandscapeView() { //Make sure that the necessary views are present in the layout Assert.assertNotNull(timetableContainer); Assert.assertNotNull(scheduleContainer); //Leave space at the top for the day names View dayView = View.inflate(this, R.layout.fragment_day_name, null); //Black line to separate the timetable from the schedule View dayViewLine = dayView.findViewById(R.id.day_line); dayViewLine.setVisibility(View.VISIBLE); //Add the day view to the top of the timetable timetableContainer.addView(dayView); //Find the index of the given date int currentDayIndex = date.getDayOfWeek().getValue(); //Go through the 7 days of the week for (int i = 1; i < 8; i++) { DayOfWeek day = DayOfWeek.of(i); //Set up the day name dayView = View.inflate(this, R.layout.fragment_day_name, null); TextView dayViewTitle = (TextView) dayView.findViewById(R.id.day_name); dayViewTitle.setText(DayUtils.getString(this, day)); scheduleContainer.addView(dayView); //Set up the schedule container for that one day LinearLayout scheduleContainer = new LinearLayout(this); scheduleContainer.setOrientation(LinearLayout.VERTICAL); scheduleContainer.setLayoutParams(new LinearLayout.LayoutParams( getResources().getDimensionPixelSize(R.dimen.cell_landscape_width), ViewGroup.LayoutParams.WRAP_CONTENT)); //Fill the schedule for the current day fillSchedule(this.timetableContainer, scheduleContainer, date.plusDays(i - currentDayIndex), false); //Add the current day to the schedule container this.scheduleContainer.addView(scheduleContainer); //Line View line = new View(this); line.setBackgroundColor(Color.BLACK); line.setLayoutParams( new ViewGroup.LayoutParams(getResources().getDimensionPixelSize(R.dimen.schedule_line), ViewGroup.LayoutParams.MATCH_PARENT)); this.scheduleContainer.addView(line); } }
From source file:com.sigilance.CardEdit.MainActivity.java
private void promptForChangePin(final int mode) { AlertDialog.Builder builder = new AlertDialog.Builder(this); if (mode == 0x83) builder.setTitle(R.string.action_change_pw3); else//from ww w . ja v a 2 s .c o m builder.setTitle(R.string.action_change_pw1); final String typeString = mode == 0x83 ? "Admin" : "User"; String defaultString = mode == 0x83 ? "12345678" : "123456"; builder.setMessage(String.format("REMINDER: The default %s PIN is %s", typeString, defaultString)); final EditText oldPinInput = new EditText(this); oldPinInput.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD); oldPinInput.setHint(String.format("Old %s PIN", mode == 0x83 ? "Admin" : "User")); final EditText newPinInput = new EditText(this); newPinInput.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD); newPinInput.setHint(String.format("New %s PIN", mode == 0x83 ? "Admin" : "User")); final EditText confirmPinInput = new EditText(this); confirmPinInput.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD); confirmPinInput.setHint("Repeat New PIN"); LinearLayout fields = new LinearLayout(this); fields.setOrientation(LinearLayout.VERTICAL); fields.addView(oldPinInput); fields.addView(newPinInput); fields.addView(confirmPinInput); builder.setView(fields); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Placeholder; we will override this } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); final AlertDialog dialog = builder.create(); dialog.show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (oldPinInput.getText().toString().length() == 0 || newPinInput.getText().toString().length() == 0) { Toast.makeText(MainActivity.this, "Enter a PIN!", Toast.LENGTH_SHORT).show(); return; } if (!(confirmPinInput.getText().toString().equals(newPinInput.getText().toString()))) { newPinInput.setText(""); confirmPinInput.setText(""); Toast.makeText(MainActivity.this, "PINs did not match.", Toast.LENGTH_SHORT).show(); return; } int minPinLength = (mode == 0x83) ? 8 : 6; if (oldPinInput.getText().toString().length() < minPinLength || newPinInput.getText().toString().length() < minPinLength) { newPinInput.setText(""); confirmPinInput.setText(""); Toast.makeText(MainActivity.this, String.format("%s PIN must be at least %d digits.", typeString, minPinLength), Toast.LENGTH_SHORT).show(); return; } // Once we have valid PINs, add the pending operation. mPendingOperations.add(new PendingChangePinOperation(mode, oldPinInput.getText().toString(), newPinInput.getText().toString())); // And prompt the user to change the PIN. hideUi(); findTextViewById(R.id.id_action_reqiured_warning).setText(R.string.warning_tap_card_to_change); dialog.dismiss(); } }); }
From source file:org.apache.cordova.AndroidChromeClient.java
@Override /**/* w ww .j a v a 2s . c om*/ * Ask the host application for a custom progress view to show while * a <video> is loading. * @return View The progress view. */ public View getVideoLoadingProgressView() { if (mVideoProgressView == null) { // Create a new Loading view programmatically. // create the linear layout LinearLayout layout = new LinearLayout(this.appView.getContext()); layout.setOrientation(LinearLayout.VERTICAL); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); layout.setLayoutParams(layoutParams); // the proress bar ProgressBar bar = new ProgressBar(this.appView.getContext()); LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); barLayoutParams.gravity = Gravity.CENTER; bar.setLayoutParams(barLayoutParams); layout.addView(bar); mVideoProgressView = layout; } return mVideoProgressView; }
From source file:com.astuetz.PagerSlidingTabStripPlus.java
private void addTab(final int position, View tab) { tab.setFocusable(true);/*from ww w . j a v a 2s . co m*/ tab.setPadding(tabPaddingLeft, tabPaddingTop, tabPaddingRight, tabPaddingBottom); LinearLayout tabLayout = new LinearLayout(getContext()); tabLayout.setOrientation(LinearLayout.VERTICAL); tabLayout.setGravity(Gravity.CENTER); tabLayout.addView(tab, 0, defaultTabLayoutParams); tabLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); tabsContainer.addView(tabLayout, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:mn.today.TheHubActivity.java
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1) private AlertDialog.Builder generateCustomDialog(EditText nameInputET) { AlertDialog.Builder newFlowDialog = new AlertDialog.Builder(TheHubActivity.this); //Sets up Layout Parameters LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); params.setMarginStart(42);//from ww w . j a va2 s.c o m params.setMarginEnd(50); AppUtils.setNameInputFilters(nameInputET); //Adds the ET and params to the layout of the dialog box layout.addView(nameInputET, params); newFlowDialog.setTitle(" ?."); newFlowDialog.setView(layout); return newFlowDialog; }
From source file:com.actionbarsherlock.internal.widget.IcsListPopupWindow.java
private int buildDropDown() { ViewGroup dropDownView;//from ww w. j a v a2s . c om int otherHeights = 0; if (mDropDownList == null) { Context context = mContext; mDropDownList = new DropDownListView(context, !mModal); if (mDropDownListHighlight != null) { mDropDownList.setSelector(mDropDownListHighlight); } mDropDownList.setAdapter(mAdapter); mDropDownList.setOnItemClickListener(mItemClickListener); mDropDownList.setFocusable(true); mDropDownList.setFocusableInTouchMode(true); mDropDownList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position != -1) { DropDownListView dropDownList = mDropDownList; if (dropDownList != null) { dropDownList.mListSelectionHidden = false; } } } public void onNothingSelected(AdapterView<?> parent) { } }); mDropDownList.setOnScrollListener(mScrollListener); if (mItemSelectedListener != null) { mDropDownList.setOnItemSelectedListener(mItemSelectedListener); } dropDownView = mDropDownList; View hintView = mPromptView; if (hintView != null) { // if an hint has been specified, we accomodate more space for it and // add a text view in the drop down menu, at the bottom of the list LinearLayout hintContainer = new LinearLayout(context); hintContainer.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams hintParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, 0, 1.0f); switch (mPromptPosition) { case POSITION_PROMPT_BELOW: hintContainer.addView(dropDownView, hintParams); hintContainer.addView(hintView); break; case POSITION_PROMPT_ABOVE: hintContainer.addView(hintView); hintContainer.addView(dropDownView, hintParams); break; default: break; } // measure the hint's height to find how much more vertical space // we need to add to the drop down's height int widthSpec = MeasureSpec.makeMeasureSpec(mDropDownWidth, MeasureSpec.AT_MOST); int heightSpec = MeasureSpec.UNSPECIFIED; hintView.measure(widthSpec, heightSpec); hintParams = (LinearLayout.LayoutParams) hintView.getLayoutParams(); otherHeights = hintView.getMeasuredHeight() + hintParams.topMargin + hintParams.bottomMargin; dropDownView = hintContainer; } mPopup.setContentView(dropDownView); } else { dropDownView = (ViewGroup) mPopup.getContentView(); final View view = mPromptView; if (view != null) { LinearLayout.LayoutParams hintParams = (LinearLayout.LayoutParams) view.getLayoutParams(); otherHeights = view.getMeasuredHeight() + hintParams.topMargin + hintParams.bottomMargin; } } // getMaxAvailableHeight() subtracts the padding, so we put it back // to get the available height for the whole window int padding = 0; Drawable background = mPopup.getBackground(); if (background != null) { background.getPadding(mTempRect); padding = mTempRect.top + mTempRect.bottom; // If we don't have an explicit vertical offset, determine one from the window // background so that content will line up. if (!mDropDownVerticalOffsetSet) { mDropDownVerticalOffset = -mTempRect.top; } } // Max height available on the screen for a popup. boolean ignoreBottomDecorations = mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED; final int maxHeight = /*mPopup.*/getMaxAvailableHeight(mDropDownAnchorView, mDropDownVerticalOffset, ignoreBottomDecorations); if (mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) { return maxHeight + padding; } final int listContent = /*mDropDownList.*/measureHeightOfChildren(MeasureSpec.UNSPECIFIED, 0, -1/*ListView.NO_POSITION*/, maxHeight - otherHeights, -1); // add padding only if the list has items in it, that way we don't show // the popup if it is not needed if (listContent > 0) otherHeights += padding; return listContent + otherHeights; }