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.support.SignInActivity.java
@Override public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { switch (requestCode) { case REQUEST_EDIT_API: { if (resultCode == RESULT_OK) { mAPIUrlFormat = data.getStringExtra(Accounts.API_URL_FORMAT); mAuthType = data.getIntExtra(Accounts.AUTH_TYPE, ParcelableCredentials.AUTH_TYPE_OAUTH); mSameOAuthSigningUrl = data.getBooleanExtra(Accounts.SAME_OAUTH_SIGNING_URL, false); mNoVersionSuffix = data.getBooleanExtra(Accounts.NO_VERSION_SUFFIX, false); mConsumerKey = data.getStringExtra(Accounts.CONSUMER_KEY); mConsumerSecret = data.getStringExtra(Accounts.CONSUMER_SECRET); final boolean isTwipOMode = mAuthType == ParcelableCredentials.AUTH_TYPE_TWIP_O_MODE; mUsernamePasswordContainer.setVisibility(isTwipOMode ? View.GONE : View.VISIBLE); mSignInSignUpContainer//from ww w. j a v a2 s. c o m .setOrientation(isTwipOMode ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL); } setSignInButton(); invalidateOptionsMenu(); break; } case REQUEST_BROWSER_SIGN_IN: { if (resultCode == BaseAppCompatActivity.RESULT_OK && data != null) { doLogin(data); } break; } } super.onActivityResult(requestCode, resultCode, data); }
From source file:de.vanita5.twittnuker.fragment.support.BaseSupportListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the returned * view hierarchy <em>must</em> have a ListView whose id is * {@link android.R.id#list android.R.id.list} and can optionally have a * sibling view id {@link android.R.id#empty android.R.id.empty} that is to * be shown when the list is empty./*from w w w . j a va 2 s . c o m*/ * * <p> * If you are overriding this method with your own custom content, consider * including the standard layout {@link android.R.layout#list_content} in * your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only way * to have the built-in indeterminant progress state be shown. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setTextAppearance(context, ThemeUtils.getTextAppearanceLarge(context)); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lv.setOnScrollListener(this); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:com.watabou.noosa.Game.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Context context = getApplicationContext(); StringsManager.setContext(context);//from ww w.jav a 2 s .c om if (!BuildConfig.DEBUG) { EventCollector.logEvent("apk signature", Util.getSignature(this)); } FileSystem.setContext(context); ModdingMode.setContext(context); try { version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; } catch (NameNotFoundException e) { version = "???"; versionCode = 0; } setVolumeControlStream(AudioManager.STREAM_MUSIC); view = new GLSurfaceView(this); view.setEGLContextClientVersion(2); // Hope this allow game work on broader devices list // view.setEGLConfigChooser( false ); view.setRenderer(this); view.setOnTouchListener(this); layout = new LinearLayout(this); getLayout().setOrientation(LinearLayout.VERTICAL); getLayout().addView(view); setContentView(getLayout()); }
From source file:com.discord.chipsview.ChipsView.java
private void init() { mDensity = getResources().getDisplayMetrics().density; mChipsContainer = new RelativeLayout(getContext()); addView(mChipsContainer);//from www.j a va 2 s. co m // Dummy item to prevent AutoCompleteTextView from receiving focus LinearLayout linearLayout = new LinearLayout(getContext()); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(0, 0); linearLayout.setLayoutParams(params); linearLayout.setFocusable(true); linearLayout.setFocusableInTouchMode(true); mChipsContainer.addView(linearLayout); mEditText = new ChipsEditText(getContext(), this); final int chipHeightWithPadding = (int) ((CHIP_HEIGHT * mDensity) + mVerticalSpacing); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, chipHeightWithPadding); layoutParams.leftMargin = (int) (5 * mDensity); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mEditText.setLayoutParams(layoutParams); mEditText.setPadding(0, 0, 0, mVerticalSpacing); mEditText.setBackgroundColor(Color.argb(0, 0, 0, 0)); mEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); mEditText.setInputType(InputType.TYPE_CLASS_TEXT); mEditText.setTextColor(mChipsSearchTextColor); mEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mChipsSearchTextSize); mChipsContainer.addView(mEditText); mRootChipsLayout = new ChipsVerticalLinearLayout(getContext(), chipHeightWithPadding); mRootChipsLayout.setOrientation(LinearLayout.VERTICAL); mRootChipsLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); mRootChipsLayout.setPadding(0, (int) (SPACING_TOP * mDensity), 0, 0); mChipsContainer.addView(mRootChipsLayout); initListener(); onChipsChanged(false); }
From source file:com.kuloud.android.calendarview.CalendarView.java
private void setupChildren() { int tileSize = (int) dp2px(getContext(), DEFAULT_TILE_SIZE_DP); root = new LinearLayout(getContext()); root.setOrientation(LinearLayout.VERTICAL); root.setClipChildren(false);// ww w . jav a 2 s . co m root.setClipToPadding(false); LayoutParams p = new LayoutParams(tileSize * MonthView.DEFAULT_DAYS_IN_WEEK, tileSize * (MonthView.DEFAULT_MONTH_TILE_HEIGHT + 1)); p.gravity = Gravity.CENTER; addView(root, p); topbar = LayoutInflater.from(getContext()).inflate(R.layout.calendar_toolbar, root, false); root.addView(topbar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1)); titleMonth = (TextView) topbar.findViewById(R.id.tv_calendar_toolbar_month); titlePercent = (TextView) topbar.findViewById(R.id.tv_calendar_toolbar_percent); pager.setId(R.id.mcv_pager); pager.setOffscreenPageLimit(1); root.addView(pager, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, MonthView.DEFAULT_MONTH_TILE_HEIGHT)); }
From source file:com.nextgis.mobile.map.LocalTMSLayer.java
protected static void showPropertiesDialog(final MapBase map, final boolean bCreate, String layerName, int type, final Uri uri, final LocalTMSLayer layer) { final LinearLayout linearLayout = new LinearLayout(map.getContext()); final EditText input = new EditText(map.getContext()); input.setText(layerName);/* w w w . j a va 2s. c om*/ final ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(map.getContext(), android.R.layout.simple_spinner_item); final Spinner spinner = new Spinner(map.getContext()); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); adapter.add(map.getContext().getString(R.string.tmstype_qtiles)); adapter.add(map.getContext().getString(R.string.tmstype_osm)); adapter.add(map.getContext().getString(R.string.tmstype_normal)); adapter.add(map.getContext().getString(R.string.tmstype_ngw)); if (type == TMSTYPE_OSM) { spinner.setSelection(1); } else { spinner.setSelection(2); } final TextView stLayerName = new TextView(map.getContext()); stLayerName.setText(map.getContext().getString(R.string.layer_name) + ":"); final TextView stLayerType = new TextView(map.getContext()); stLayerType.setText(map.getContext().getString(R.string.layer_type) + ":"); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(stLayerName); linearLayout.addView(input); linearLayout.addView(stLayerType); linearLayout.addView(spinner); 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) { int tmsType = 0; switch (spinner.getSelectedItemPosition()) { case 0: case 1: tmsType = TMSTYPE_OSM; break; case 2: case 3: tmsType = TMSTYPE_NORMAL; break; } if (bCreate) { create(map, input.getText().toString(), tmsType, uri); } else { layer.setName(input.getText().toString()); layer.setTMSType(tmsType); 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.aosijia.dragonbutler.ui.widget.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 w ww. ja v a 2s . co 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); if (checkDeviceHasNavigationBar(getActivity())) { parent.setPadding(0, 0, 0, getNavBarHeight(getActivity())); } else { parent.setPadding(0, 0, 0, 0); } parent.addView(mBg); parent.addView(mPanel); return parent; }
From source file:com.shenzhen.elson.selectordialoglib.SelectorDialog.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(SelectorDialog.BG_VIEW_ID); 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;/*from ww w. jav a2 s .c o m*/ 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.cmput301w15t15.travelclaimsapp.activitys.EditClaimActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.cmenu_dlist_delete: ClaimListController.removeDestination(destAdaptor.getItem(info.position), theClaim); destAdaptor.notifyDataSetChanged(); return true; case R.id.cmenu_dlist_edit: //show a dialog for editing destinations final EditText enterLocation = new EditText(this); final EditText enterReason = new EditText(this); enterLocation.setText(destAdaptor.getItem(info.position).getLocation()); enterReason.setText(destAdaptor.getItem(info.position).getReason()); enterLocation.setHint("Enter location"); enterReason.setHint("Enter reason"); LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(enterLocation); linearLayout.addView(enterReason); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setView(linearLayout);//from ww w .j ava 2 s . com alert.setPositiveButton("Add", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { destAdaptor.getItem(info.position).setLocation(enterLocation.getText().toString()); destAdaptor.getItem(info.position).setReason(enterReason.getText().toString()); destAdaptor.notifyDataSetChanged(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); alert.show(); return true; case R.id.cmenu_dlist_geolocation: adaptorPos = info.position; AlertDialog.Builder alertGl = new AlertDialog.Builder(this); alertGl.setPositiveButton("GPS", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (GeoLocationController.checkGPSEnabled()) { GeoLocationController.setDestinationGeoLocationGPS(destAdaptor.getItem(info.position)); destAdaptor.notifyDataSetChanged(); } } }); alertGl.setNegativeButton("Map", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //Open map view \ Intent intent = GeoLocationController.pickLocationIntent(EditClaimActivity.this); startActivityForResult(intent, GET_GEOLOCATION_CODE); } }); alertGl.show(); return true; case R.id.cmenu_delete_tag: ClaimListController.removeTag(theClaim, tagAdaptor.getItem(info.position)); tagAdaptor.notifyDataSetChanged(); return true; case R.id.cmenu_rename_tag: //create a Alert dialog for editing tag name final TextView enterTag = new AutoCompleteTextView(this); enterTag.setHint("Enter tag"); AlertDialog.Builder alertTag = new AlertDialog.Builder(this); alertTag.setView(enterTag); alertTag.setPositiveButton("Add", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { tagAdaptor.getItem(info.position).setName(enterTag.getText().toString()); tagAdaptor.notifyDataSetChanged(); } }); alertTag.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); alertTag.show(); return true; default: return super.onContextItemSelected(item); } }
From source file:com.rashwan.reactive_popular_movies.common.utilities.ExpandableTextView.java
private void init(AttributeSet attrs) { TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ExpandableTextView); mMaxCollapsedLines = typedArray.getInt(R.styleable.ExpandableTextView_maxCollapsedLines, MAX_COLLAPSED_LINES);/*from w ww.j a v a 2s .c o m*/ mAnimationDuration = typedArray.getInt(R.styleable.ExpandableTextView_animDuration, DEFAULT_ANIM_DURATION); mExpandDrawable = typedArray.getDrawable(R.styleable.ExpandableTextView_expandDrawable); mCollapseDrawable = typedArray.getDrawable(R.styleable.ExpandableTextView_collapseDrawable); if (mExpandDrawable == null) { mExpandDrawable = getDrawable(getContext(), R.drawable.ic_expand_more_white_12dp); } if (mCollapseDrawable == null) { mCollapseDrawable = getDrawable(getContext(), R.drawable.ic_expand_less_white_12dp); } typedArray.recycle(); // enforces vertical orientation setOrientation(LinearLayout.VERTICAL); // default visibility is gone setVisibility(GONE); }