List of usage examples for android.widget ScrollView addView
@Override public void addView(View child)
From source file:at.wada811.android.library.demos.SplashActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // catch UncaughtException Thread.setDefaultUncaughtExceptionHandler(new CrashExceptionHandler(getApplicationContext())); super.onCreate(savedInstanceState); // ???????/*from w ww. j av a2s . co m*/ File file = ResourceUtils.getFile(this, CrashExceptionHandler.FILE_NAME); if (file.exists()) { String report = ResourceUtils.readFileString(this, CrashExceptionHandler.FILE_NAME); ScrollView scrollView = new ScrollView(this); TextView textView = new TextView(this); textView.setText(report); scrollView.addView(textView); setContentView(scrollView); file.delete(); } else { startActivity(new Intent(this, MainActivity.class)); finish(); } }
From source file:com.alexive.graphicalutils.demo.CardsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //On a real project, you'd define the layout in an xml file this.mLinearLayout = new LinearLayout(this); this.mLinearLayout.setOrientation(LinearLayout.VERTICAL); ScrollView sv = new ScrollView(this); sv.addView(this.mLinearLayout); setContentView(sv);// w w w. ja v a 2s. co m this.mCardBuilder = new CardBuilder(CardBuilder.CardType.FULL_WIDTH_IMAGE); this.params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); int sixteenDP = ViewUtils.convertDPtoPixels(this, 16); this.params.setMargins(sixteenDP, sixteenDP / 2, sixteenDP, sixteenDP / 2); Drawable cardImage = ContextCompat.getDrawable(this, R.drawable.lisbon); this.mCardBuilder.setTitle("Card title here").setSubTitle("subtitle here") .addSupplementalAction(new CardBuilder.CardAction("A1", 1)) .addSupplementalAction(new CardBuilder.CardAction("A2", 2)).addActionClickListener(this) .setText("Text here! - To create a card like this use the " + "FULL_WIDTH_IMAGE card type") .setImage(cardImage); addCardToLayout(); this.mCardBuilder.setType(CardBuilder.CardType.IMAGE_AS_BACKGROUND).useLightTheme(false) //This one supports dark theme only .setText("Text here. Use IMAGE_AS_BACKGROUND for a card like this one"); addCardToLayout(); this.mCardBuilder.setType(CardBuilder.CardType.IMAGE_FILLS_WITH_ACTIONS_ON_LEFT).useLightTheme(true) .setText("Text here. IMAGE_FILLS_WITH_ACTIONS_ON_LEFT. " + "Notice this one doesn't display text"); addCardToLayout(); this.mCardBuilder.setType(CardBuilder.CardType.IMAGE_NEXT_TO_TITLE) .setText("Notice the previous one (IMAGE_FILLS_WITH_ACTIONS_ON_LEFT) " + "doesn't show any text. This one's a IMAGE_NEXT_TO_TITLE sample"); addCardToLayout(); this.mCardBuilder.reset(); //This clears the builder, you'll have to set it up again this.mCardBuilder.setType(CardBuilder.CardType.IMAGE_FILLS_WITH_ACTIONS_ON_LEFT).setImage(cardImage) .addSupplementalAction(new CardBuilder.CardAction( ContextCompat.getDrawable(this, R.drawable.ic_favorite_black_24dp), 3)) .addSupplementalAction(new CardBuilder.CardAction( ContextCompat.getDrawable(this, R.drawable.ic_info_outline_black_24dp), 4)) .addActionClickListener(this); addCardToLayout(); this.mCardBuilder.setType(CardBuilder.CardType.FULL_WIDTH_IMAGE).setTitle("Look, icons!") .setText("You can use icons as actions instead of text (or mix both)") .addSupplementalAction(new CardBuilder.CardAction("A5", 5)); addCardToLayout(); this.mCardBuilder.setType(CardBuilder.CardType.NO_IMAGE).setTitle("<Title>") .setText("This is the simplest one: NO_IMAGE"); addCardToLayout(); }
From source file:edu.htl3r.schoolplanner.gui.timetable.WeekViewPageAdapter.java
@Override public synchronized View instantiateItem(View collection, int position) { int di = position - 50; DateTime ad = new DateTime(); ad.set(date.getDay() + (di * 7), date.getMonth(), date.getYear()); InputTransferObject input = new InputTransferObject(ad, position); if (!view_cach[position].isDataHere()) { downloadschlange.add(input);/*from ww w . java 2 s. com*/ } ViewPager tmp = (ViewPager) collection; tmp.removeView((ScrollView) view_cach[position].getParent()); oldpos = position; ScrollView scr = new ScrollView(context); scr.addView(view_cach[position]); tmp.addView(scr); return scr; }
From source file:org.odk.collect.android.fragments.dialogs.RankingWidgetDialog.java
private ScrollView setUpRankingLayout(List<String> values, FormIndex formIndex) { LinearLayout rankingLayout = new LinearLayout(getContext()); rankingLayout.setOrientation(LinearLayout.HORIZONTAL); rankingLayout.addView(setUpPositionsLayout(values)); rankingLayout.addView(setUpRecyclerView(values, formIndex)); rankingLayout.setPadding(10, 0, 10, 0); ScrollView scrollView = new ScrollView(getContext()); scrollView.addView(rankingLayout); return scrollView; }
From source file:com.normalexception.app.rx8club.fragment.utils.CompressionFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainApplication.setState(AppState.State.UTIL_COMPRESSION, this); RelativeLayout rl = (RelativeLayout) getView().findViewById(R.id.content_frame); v = getActivity().getLayoutInflater().inflate(R.layout.view_compression, rl); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);//from w w w .j av a 2s. co m params.addRule(RelativeLayout.BELOW, R.id.mainlisttitle); ScrollView sv = new ScrollView(getActivity()); sv.addView(v); sv.setLayoutParams(params); rl.addView(sv); ViewHolder.get(v, R.id.compressionNormalize).setOnClickListener(new CompressionListener()); }
From source file:org.dalmasso.ietfsched.ui.WellNoteFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ScrollView scroller = new ScrollView(getActivity()); TextView text = new TextView(getActivity()); text.setText(WELL_NOTE_TEXT);//w w w . ja va 2s. c o m scroller.addView(text); return scroller; }
From source file:com.google.adsensequickstart.DisplayReportFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ScrollView sv = new ScrollView(getActivity()); TableLayout tl = new TableLayout(getActivity()); sv.addView(tl); if (displayReportController == null) { return sv; }/*from w ww.j a v a2 s . co m*/ AdsenseReportsGenerateResponse response = displayReportController.getReportResponse(); TableLayout.LayoutParams tableRowParams = new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); tableRowParams.setMargins(10, 10, 10, 10); TableRow.LayoutParams tvParams = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); tvParams.setMargins(10, 10, 10, 10); List<Headers> headers = response.getHeaders(); TableRow tr = new TableRow(getActivity()); tl.addView(tr); for (Headers header : headers) { TextView tv = new TextView(getActivity()); tv.setText(header.getName()); tr.setLayoutParams(tableRowParams); tr.addView(tv); } if (response.getRows() != null && !response.getRows().isEmpty()) { for (List<String> row : response.getRows()) { TableRow trow = new TableRow(getActivity()); tl.addView(trow); for (String cell : row) { TextView tv = new TextView(getActivity()); tv.setText(cell); trow.addView(tv); tv.setLayoutParams(tvParams); tv.setPadding(15, 5, 15, 5); tv.setBackgroundColor(Color.WHITE); } } } return sv; }
From source file:com.ryan.ryanreader.activities.CommentEditActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { PrefsUtility.applyTheme(this); super.onCreate(savedInstanceState); final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.comment_edit); textEdit = (EditText) layout.findViewById(R.id.comment_reply_text); if (getIntent() != null && getIntent().hasExtra("commentIdAndType")) { commentIdAndType = getIntent().getStringExtra("commentIdAndType"); textEdit.setText(getIntent().getStringExtra("commentText")); } else if (savedInstanceState != null && savedInstanceState.containsKey("commentIdAndType")) { textEdit.setText(savedInstanceState.getString("commentText")); commentIdAndType = savedInstanceState.getString("commentIdAndType"); }/* ww w. ja va 2 s . co m*/ final ScrollView sv = new ScrollView(this); sv.addView(layout); setContentView(sv); }
From source file:com.glacialsoftware.googolplex.LicenseDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new Builder(getActivity()); ScrollView scrollView = new ScrollView(getActivity()); TextView textView = new TextView(getActivity()); builder.setTitle("Apache License, Version 2.0"); textView.setText(apache2kolavar);/*from w w w . jav a2 s .com*/ scrollView.addView(textView); builder.setView(scrollView); return builder.create(); }
From source file:com.commonsware.android.arXiv.arXiv.java
private boolean applyMenuChoice(MenuItem item) { switch (item.getItemId()) { case ABOUT_ID: String str = getString(R.string.about_text); TextView wv = new TextView(this); wv.setPadding(16, 0, 16, 16);//from w w w . jav a 2s . co m wv.setText(str); ScrollView scwv = new ScrollView(this); scwv.addView(wv); Dialog dialog = new Dialog(this) { public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode != KeyEvent.KEYCODE_DPAD_LEFT) this.dismiss(); return true; } }; dialog.setTitle(R.string.about_arxiv_droid); dialog.addContentView(scwv, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); dialog.show(); return (true); case HISTORY_ID: Intent myIntent = new Intent(this, DownloadsActivity.class); startActivity(myIntent); return (true); case PREF_ID: if (Build.VERSION.SDK_INT >= 11) { startActivity(new Intent(this, EditPreferences.class)); } else { startActivity(new Intent(this, EditPreferencesCompat.class)); } return (true); case DONATE_ID: Intent goToMarket = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.jd.android.arXiv")); try { startActivity(goToMarket); } catch (Exception ef) { Toast.makeText(this, "Market Not Installed", Toast.LENGTH_SHORT).show(); } return (true); case SEARCH_ID: Intent search = new Intent(this, SearchWindow.class); startActivity(search); return (true); } return (false); }