List of usage examples for android.widget LinearLayout setOrientation
public void setOrientation(@OrientationMode int orientation)
From source file:org.openpilot_nonag.androidgcs.PfdActivity.java
private View createUI() { LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.HORIZONTAL); layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); layout.setId(0x101);//from w w w .ja v a 2 s . co m { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.add(0x101, new PFD()); fragmentTransaction.commit(); } return layout; }
From source file:com.luskprog.doubledpager.DoublePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { MainActivity act = (MainActivity) getActivity(); mIsTheProperOrientation = act.isLandscape(); // layout containing two TextView simulating two Pages text LinearLayout ll = new LinearLayout(getActivity()); ll.setOrientation(LinearLayout.VERTICAL); TextView tv1 = new TextView(getActivity()); TextView tv2 = new TextView(getActivity()); if (mIsTheProperOrientation) { // get the data array as we have to show text for two pages. String[] data = ((MainActivity) getActivity()).getDoublePage(getArguments().getInt("position")); tv1.setText(data[0]);/*from w w w . java 2 s . c o m*/ tv2.setText(data[1]); } ll.addView(tv1); ll.addView(tv2); return ll; }
From source file:de.mkrtchyan.aospinstaller.DonationsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); layout.setId(1111111);//w w w. j av a 2s. co m setContentView(layout); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); DonationsFragment donationsFragment; donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, GOOGLE_PLAY, GOOGLE_PUBKEY, GOOGLE_CATALOG, getResources().getStringArray(R.array.donation_google_catalog_values), FLATTR, FLATTR_PROJECT_URL, FLATTR_URL); ft.replace(layout.getId(), donationsFragment, "donationsFragment"); ft.commit(); }
From source file:org.nuxeo.android.layout.LayoutDefinition.java
protected ViewGroup createTopLayoutContainer(Context ctx, ViewGroup parent) { LinearLayout container = new LinearLayout(ctx); container.setOrientation(LinearLayout.VERTICAL); LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); container.setLayoutParams(params);//ww w .j a va 2s.c o m parent.addView(container); return container; }
From source file:com.manning.androidhacks.hack004.preference.AboutDialog.java
@Override protected View onCreateDialogView() { LinearLayout layout = new LinearLayout(mContext); layout.setOrientation(LinearLayout.VERTICAL); TextView splashText = new TextView(mContext); String fmt = "Version %s<br />" + "<a href=\"http://manning.com/sessa\">MoreInfo</a>"; try {// w w w . j av a 2 s .c o m String pkg = mContext.getPackageName(); mVersionNumber = mContext.getPackageManager().getPackageInfo(pkg, 0).versionName; } catch (NameNotFoundException e) { e.printStackTrace(); } if (mVersionNumber != null) { String aboutMsg = String.format(fmt, mVersionNumber); splashText.setText(Html.fromHtml(aboutMsg)); splashText.setMovementMethod(LinkMovementMethod.getInstance()); } layout.addView(splashText); return layout; }
From source file:org.mitre.svmp.auth.module.PasswordChangeModule.java
public View generateUI(Context context) { // create the password change inputs input1 = new EditText(context); input1.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); input1.setHint("New password"); input2 = new EditText(context); input2.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); input2.setHint("Confirm new password"); LinearLayout view = new LinearLayout(context); view.setOrientation(LinearLayout.VERTICAL); view.addView(input1);//from w w w.ja va 2 s .com view.addView(input2); return view; }
From source file:com.github.preferencefragment.preference.LaunchingPreferences.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /*//from w w w. j a v a 2s . com * These preferences have defaults, so before using them go apply those * defaults. This will only execute once -- when the defaults are applied * a boolean preference is set so they will not be applied again. */ PreferenceManager.setDefaultValues(this, R.xml.advanced_preferences, false); // Simple layout LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); setContentView(layout); // Create a simple button that will launch the preferences Button launchPreferences = new Button(this); launchPreferences.setText(getString(R.string.launch_preference_activity)); launchPreferences.setOnClickListener(this); layout.addView(launchPreferences, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); mCounterText = new TextView(this); layout.addView(mCounterText, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); updateCounterText(); }
From source file:com.eggsoftware.flingsolver.gui.DrawSolutionPageAdapter.java
@Override public Object instantiateItem(View collection, int position) { // Create the "Step N of T" TextView TextView stepTextView = new TextView(this.context); stepTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); stepTextView.setTextColor(Color.rgb(113, 113, 113)); stepTextView.setGravity(Gravity.CENTER); stepTextView.setText(String.format(this.context.getResources().getString(R.string.step_of), position + 1, this.solution.size())); // Create the boar with the current step of the solution BoardCanvas board = new BoardCanvas(this.context); board.setBoardRepresentation(this.solution.get(position).getBoard()); board.setArrow(this.solution.get(position).getRow(), this.solution.get(position).getCol(), this.solution.get(position).getDirection()); // Add the components to the layout LinearLayout layout = new LinearLayout(this.context); layout.setOrientation(LinearLayout.VERTICAL); layout.setPadding(16, 20, 16, 16);/*from www . ja v a 2 s. c o m*/ RelativeLayout relativeLatout = new RelativeLayout(this.context); relativeLatout.setLayoutParams( new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f)); relativeLatout.addView(board); layout.addView(relativeLatout); layout.addView(stepTextView); ((ViewPager) collection).addView(layout, 0); return layout; }
From source file:com.art2cat.dev.moonlightnote.controller.settings.CommonSettingsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment if (getArguments() != null) { mType = getArguments().getInt("type"); }/*from www. ja v a2s . c om*/ LinearLayout linearLayout = new LinearLayout(getActivity()); linearLayout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); linearLayout.setLayoutParams(params); ScrollView scrollView = new ScrollView(getActivity()); scrollView.setLayoutParams(params); linearLayout.addView(scrollView); TextView textView = new TextView(getActivity()); textView.setLayoutParams(params); int padding = getResources().getDimensionPixelOffset(R.dimen.padding); textView.setPadding(padding, padding, padding, padding); switch (mType) { case Constants.FRAGMENT_ABOUT: textView.setGravity(Gravity.CENTER); textView.setText(getContent()); getActivity().setTitle(R.string.settings_about); break; case Constants.FRAGMENT_LICENSE: textView.setGravity(Gravity.CENTER); textView.setText(getContent()); getActivity().setTitle(R.string.settings_license); break; case Constants.FRAGMENT_POLICY: textView.setGravity(Gravity.START); textView.setText(getContent()); getActivity().setTitle(R.string.settings_policy); break; } setHasOptionsMenu(true); scrollView.addView(textView); return linearLayout; }
From source file:com.kai.uGuide.ui.fragment.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/*from w w w . j av a 2 s . co m*/ // final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources() // .getDisplayMetrics()); // // TextView v = new TextView(getActivity()); // params.setMargins(margin, margin, margin, margin); // v.setLayoutParams(params); // v.setLayoutParams(params); // v.setGravity(Gravity.CENTER); // v.setBackgroundResource(R.drawable.background_card); // v.setText("CARD " + (position + 1)); // // fl.addView(v); LinearLayout pagerlayout = new LinearLayout(getActivity()); pagerlayout.setOrientation(LinearLayout.HORIZONTAL); pagerlayout.setId(300 + position); if (page == 0) adapter = AdapterTransitionFragment.newInstance(position); else adapter = ResultAdapterTransitionFragment.newInstance(position); getFragmentManager().beginTransaction().add(pagerlayout.getId(), adapter, "someTag" + position).commit(); fl.addView(pagerlayout); return fl; }