List of usage examples for android.widget TableRow addView
public void addView(View child)
Adds a child view.
From source file:com.adarshahd.indianrailinfo.donate.TrainDetails.java
private void createTableLayoutTrainFare() { if (mPage.contains("SORRY")) { TextView textViewTrnDtls = new TextView(mActivity); textViewTrnDtls.setText("Not a valid class, Please select a different class and try again."); textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewTrnDtls.setPadding(10, 10, 10, 10); textViewTrnDtls.setTextColor(Color.RED); mFrameLayout.removeAllViews();/*from w ww . j ava2 s . co m*/ mFrameLayout.addView(textViewTrnDtls); if (mDialog.isShowing()) { mDialog.cancel(); } return; } if (mPage.contains("ISL Of")) { TextView textViewTrnDtls = new TextView(mActivity); textViewTrnDtls.setText("Station is not in ISL Of the Train. \nPlease modify the source/destination!"); textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewTrnDtls.setPadding(10, 10, 10, 10); textViewTrnDtls.setTextColor(Color.RED); mFrameLayout.removeAllViews(); mFrameLayout.addView(textViewTrnDtls); if (mDialog.isShowing()) { mDialog.cancel(); } return; } if (mPage.contains("ERROR")) { TextView textViewTrnDtls = new TextView(mActivity); textViewTrnDtls.setText("Your request resulted in an error.\nPlease check!"); textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewTrnDtls.setPadding(10, 10, 10, 10); textViewTrnDtls.setTextColor(Color.RED); mFrameLayout.removeAllViews(); mFrameLayout.addView(textViewTrnDtls); if (mDialog.isShowing()) { mDialog.cancel(); } return; } if (mPage.contains("Network Connectivity")) { TextView textViewTrnDtls = new TextView(mActivity); textViewTrnDtls.setText("Looks like the server is busy.\nPlease try later!"); textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewTrnDtls.setPadding(10, 10, 10, 10); textViewTrnDtls.setTextColor(Color.RED); mFrameLayout.removeAllViews(); mFrameLayout.addView(textViewTrnDtls); if (mDialog.isShowing()) { mDialog.cancel(); } return; } if (mPage.contains("unavailable")) { TextView textViewTrnDtls = new TextView(mActivity); textViewTrnDtls.setText( "Response from server:\n\nYour request could not be processed now. \nPlease try again later!"); textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewTrnDtls.setPadding(10, 10, 10, 10); textViewTrnDtls.setTextColor(Color.RED); mFrameLayout.removeAllViews(); mFrameLayout.addView(textViewTrnDtls); if (mDialog.isShowing()) { mDialog.cancel(); } return; } if (mDetails == null || !mDetails.getTrainNumber().equals(mTrainNumber)) { Iterator iterator = null; try { iterator = mElements.first().parent().parent().parent().getElementsByTag("tr").iterator(); } catch (Exception e) { Log.i("TrainDetails", mPage); } mListFr = new ArrayList<List<String>>(); List<String> list; Element tmp; while (iterator.hasNext()) { tmp = (Element) iterator.next(); list = new ArrayList<String>(); list.add(tmp.select("td").get(0).text()); list.add(tmp.select("td").get(1).text()); mListFr.add(list); } mDetails = new Details(mListFr, TrainEnquiry.FARE, mTrainNumber); } else { mListFr = mDetails.getList(); } mTblLayoutFr = new TableLayout(mActivity); TableRow row; TextView tv1, tv2; mTblLayoutFr.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); for (int i = 0; i < mListFr.size(); i++) { row = new TableRow(mActivity); tv1 = new TextView(mActivity); tv2 = new TextView(mActivity); tv1.setText(" " + mListFr.get(i).get(0)); tv2.setText(" " + mListFr.get(i).get(1)); tv1.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium); tv2.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium); tv1.setPadding(5, 5, 5, 5); tv2.setPadding(5, 5, 5, 5); /*tv2.setBackgroundResource(R.drawable.card_divider); tv3.setBackgroundResource(R.drawable.card_divider); tv4.setBackgroundResource(R.drawable.card_divider);*/ row.addView(tv1); row.addView(tv2); row.setBackgroundResource(R.drawable.button_selector); row.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); mTblLayoutFr.addView(row); } LinearLayout ll = new LinearLayout(mActivity); ScrollView scrollView = new ScrollView(mActivity); TextView textViewTrnDtls = new TextView(mActivity); textViewTrnDtls.setText("Fare details:"); textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large); textViewTrnDtls.setPadding(10, 10, 10, 10); ll.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ll.setOrientation(LinearLayout.VERTICAL); ll.addView(textViewTrnDtls); ll.addView(mTblLayoutFr); scrollView.addView(ll); mFrameLayout.removeAllViews(); mFrameLayout.addView(scrollView); if (mDialog.isShowing()) { mDialog.cancel(); } }
From source file:org.mifos.androidclient.main.CustomerChargesDetailsActivity.java
private void updateContent(CustomerChargesDetails details) { mDetails = details;//w w w.j a v a 2 s . com TextView textView; TableLayout table; TableRow row; View disabledView; TableLayoutHelper helper = new TableLayoutHelper(this); textView = (TextView) findViewById(R.id.customerChargesDetails_amountDue); textView.setText(details.getNextDueAmount().toString()); textView = (TextView) findViewById(R.id.customerChargesDetails_amountOverdue); textView.setText(details.getTotalAmountInArrears().toString()); textView = (TextView) findViewById(R.id.customerChargesDetails_total); textView.setText(details.getTotalAmountDue().toString()); if (details.getUpcomingInstallment() != null && (ValueUtils.hasValue(details.getUpcomingInstallment().getMiscFee()) || ValueUtils.hasValue(details.getUpcomingInstallment().getMiscPenalty()) || ValueUtils.hasElements(details.getUpcomingInstallment().getFeesActionDetails()))) { disabledView = findViewById(R.id.customerChargesDetails_upcomingCharges_label); disabledView.setVisibility(View.VISIBLE); disabledView = findViewById(R.id.customerChargesDetails_upcomingCharges_scrollView); disabledView.setVisibility(View.VISIBLE); table = (TableLayout) findViewById(R.id.customerChargesDetails_upcomingCharges_table); if (ValueUtils.hasValue(details.getUpcomingInstallment().getMiscFee())) { row = helper.createTableRow(); textView = helper.createTableCell(getString(R.string.customerChargesDetails_miscFee_label), 1); row.addView(textView); textView = helper.createTableCell(details.getUpcomingInstallment().getMiscFee().toString(), 2); row.addView(textView); table.addView(row); table.addView(helper.createRowSeparator()); } if (ValueUtils.hasValue(details.getUpcomingInstallment().getMiscPenalty())) { row = helper.createTableRow(); textView = helper.createTableCell(getString(R.string.customerChargesDetails_miscPenalty_label), 1); row.addView(textView); textView = helper.createTableCell(details.getUpcomingInstallment().getMiscPenalty().toString(), 2); row.addView(textView); table.addView(row); table.addView(helper.createRowSeparator()); } if (ValueUtils.hasElements(details.getUpcomingInstallment().getFeesActionDetails())) { for (AccountFeeSchedule fee : details.getUpcomingInstallment().getFeesActionDetails()) { row = helper.createTableRow(); textView = helper.createTableCell(fee.getFeeName(), 1); row.addView(textView); textView = helper.createTableCell(fee.getFeeAmount().toString(), 2); row.addView(textView); table.addView(row); table.addView(helper.createRowSeparator()); } } } if (ValueUtils.hasElements(details.getRecentActivities())) { disabledView = findViewById(R.id.customerChargesDetails_recentAccountActivity_label); disabledView.setVisibility(View.VISIBLE); disabledView = findViewById(R.id.customerChargesDetails_recentAccountActivity_scrollView); disabledView.setVisibility(View.VISIBLE); table = (TableLayout) findViewById(R.id.customerChargesDetails_recentAccountActivity_table); for (CustomerRecentActivity activity : details.getRecentActivities()) { row = helper.createTableRow(); textView = helper.createTableCell(DateUtils.format(activity.getActivityDate()), 1); row.addView(textView); textView = helper.createTableCell(activity.getDescription(), 2); row.addView(textView); textView = helper.createTableCell(activity.getAmount(), 3); row.addView(textView); textView = helper.createTableCell(activity.getPostedBy(), 4); row.addView(textView); table.addView(row); table.addView(helper.createRowSeparator()); } } if (ValueUtils.hasElements(details.getAccountFees())) { boolean hasRecurring = false; List<AccountFee> recurringFees = new ArrayList<AccountFee>(); for (AccountFee fee : details.getAccountFees()) { if (fee.getMeetingRecurrence() != null) { hasRecurring = true; recurringFees.add(fee); } } if (hasRecurring) { disabledView = findViewById(R.id.customerChargesDetails_recurringAccountFees_label); disabledView.setVisibility(View.VISIBLE); disabledView = findViewById(R.id.customerChargesDetails_recurringAccountFees_scrollView); disabledView.setVisibility(View.VISIBLE); table = (TableLayout) findViewById(R.id.customerChargesDetails_recurringAccountFees_table); for (AccountFee fee : recurringFees) { row = helper.createTableRow(); textView = helper.createTableCell(fee.getFeeName(), 1); row.addView(textView); textView = helper.createTableCell(fee.getAccountFeeAmount().toString(), 2); row.addView(textView); textView = helper.createTableCell(fee.getMeetingRecurrence(), 2); row.addView(textView); table.addView(row); table.addView(helper.createRowSeparator()); } } } }
From source file:com.landenlabs.all_devtool.IconBaseFragment.java
/** * Show 'AnimationDrawable' information * * @param imageView/*from w w w. j a v a 2s.c o m*/ * @param animationDrawable * @param row1 * @param row2 */ private void showAnimationBtns(final ImageView imageView, final AnimationDrawable animationDrawable, TableRow row1, TableRow row2) { int[] imageResIds = new int[] { android.R.drawable.ic_media_pause, android.R.drawable.ic_media_play // , android.R.drawable.ic_media_next }; String[] descBtns = new String[] { "Pause", "Play" // , "Next" }; ImageButton btnImage; TextView btnDesc; for (int idx = 0; idx < imageResIds.length; idx++) { btnImage = new ImageButton(imageView.getContext()); btnImage.setTag(Integer.valueOf(idx)); btnImage.setImageResource(imageResIds[idx]); btnImage.setPadding(10, 10, 10, 10); btnImage.setMinimumHeight(8); btnImage.setMinimumWidth(8); btnImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int n = (Integer) v.getTag(); switch (n) { case 0: // pause animationDrawable.stop(); break; case 1: // play animationDrawable.stop(); animationDrawable.start(); break; case 2: // next break; } } }); row1.addView(btnImage); btnDesc = new TextView(imageView.getContext()); btnDesc.setText(descBtns[idx]); btnDesc.setTextSize(12); btnDesc.setGravity(Gravity.CENTER); row2.addView(btnDesc); } // Can't start now - icon not fully rendered, see onChangeFocus // animationDrawable.stop(); // animationDrawable.start(); }
From source file:com.landenlabs.all_devtool.IconBaseFragment.java
/** * Show a 'StateListDrawable' information * * @param imageView/* w ww . j a v a2s .c o m*/ * @param row1 * @param row2 * @param stateListDrawable * @param state * @param desc * @param stateIcons */ private void showStateIcon(final ImageView imageView, TableRow row1, TableRow row2, StateListDrawable stateListDrawable, int state, String desc, Set<Drawable> stateIcons) { stateListDrawable.setState(new int[] { state }); Drawable stateD = stateListDrawable.getCurrent(); if (stateD != null && !stateIcons.contains(stateD)) { stateIcons.add(stateD); ImageButton stateImageView = new ImageButton(imageView.getContext()); Drawable[] drawables = new Drawable[] { stateD, getResources().getDrawable(R.drawable.button_border_sel) }; LayerDrawable layerDrawable = new LayerDrawable(drawables); stateImageView.setImageDrawable(layerDrawable); // stateImageView.setBackgroundResource(R.drawable.button_border_sel); stateImageView.setPadding(10, 10, 10, 10); stateImageView.setMinimumHeight(8); stateImageView.setMinimumWidth(8); stateImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imageView.setImageDrawable(((ImageView) v).getDrawable()); } }); TextView stateTextView = new TextView(imageView.getContext()); stateTextView.setText(desc); stateTextView.setTextSize(12); stateTextView.setGravity(Gravity.CENTER); row1.addView(stateTextView); row2.addView(stateImageView); } }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
private int addDataRow(Iterable<String> dataSet, int rowId, Optional<Consumer<TextView>> optional) { final Context context = getContext(); if (rowsPerSet > 1) { addView(constructRowSeparator(rowsPerSet), rowId++); }/* ww w.ja va 2s.co m*/ int i = 0; boolean firstInner = true, fistRow = true; TableRow currentRow = constructRow(context, itemsInFirstRow * 2f); for (final String str : dataSet) { if (i > 0 && (fistRow ? i % itemsInFirstRow == 0 : i % itemsPerInnerRow == 0)) { i = 0; fistRow = false; addView(currentRow, rowId++); currentRow = constructRow(context, itemsPerInnerRow * 2f); firstInner = true; } final TextView textView; if (firstInner) { textView = createSpyingColumnForTableRow(str, rowId, 2f, context); firstInner = false; } else { textView = createColumnForTableRow(str, 2f, context); } final Optional<Integer> maxWidth = dataStore.getMaxWidthForData(i); if (maxWidth.isPresent()) { textView.setMaxWidth(UiUtils.dpAsPixels(context, maxWidth.get())); } if (optional.isPresent()) { optional.get().accept(textView); } currentRow.addView(textView); i++; } addView(currentRow, rowId++); return rowId; }
From source file:com.retroteam.studio.retrostudio.MeasureEditor.java
/** * Draw the grid./*from w ww. j a v a2s . co m*/ */ private void drawGrid() { //draw the grid based on project info thisMeasure = theproject.track(trackNum).measure(measureNum); TableLayout notedraw = (TableLayout) findViewById(R.id.notedraw); int notedrawlen = notedraw.getChildCount(); //get note scale final float dscale = getApplicationContext().getResources().getDisplayMetrics().density; int notewidth = (int) (144 * dscale + 0.5f); int noteheight = (int) (75 * dscale + 0.5f); for (int x = 0; x < notedrawlen; x++) { TableRow noterow = (TableRow) notedraw.getChildAt(x); List<List<Integer>> rangelist = numNotesFromGuiSnap(); for (int i = 0; i < rangelist.size(); i++) { ImageView note = new ImageView(getApplicationContext()); note.setLayoutParams(new TableRow.LayoutParams(notewidth, noteheight)); note.setTag(R.id.TAG_ROW, x); note.setTag(R.id.TAG_COLUMN, i); note.setTag(R.id.TAG_NOTE, notesdisplay[x]); note.setTag(R.id.TAG_GUISNAPRANGE, rangelist.get(i)); note.setImageResource(R.drawable.measure_outline); if (filledNotesFromIntent.size() > 0) { for (int z = 0; z < filledNotesFromIntent.size(); z++) { if ((filledNotesFromIntent.get(z)[0] == x) && (filledNotesFromIntent.get(z)[1] == i)) { note.setImageResource(R.drawable.note_filled); } } } note.setBackgroundColor(getResources().getColor(R.color.note_rest)); note.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { paintNote(v); } }); noterow.addView(note); } } }
From source file:gidaibero.android.matsol.MatrixDisplayActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); target = R.id.matrix_button;// w ww . j ava2s. co m int currentIndex; TableRow tableRow; // Define the layout. setContentView(R.layout.matrix_display_view); // Parse the values from the parent Intent intent = getIntent(); this.height = intent.getIntExtra(MatrixInputActivity.MATRIX_SIZE, 5); this.matrix = new float[this.height][]; for (int i = 0; i < this.height; i++) { this.matrix[i] = intent.getFloatArrayExtra(MatrixInputActivity.MATRIX_VALUES + i); } this.results = intent.getFloatArrayExtra(MatrixInputActivity.MATRIX_RESULTS); // the we are always a linear equation this.width = this.height + 1; // initialize the array this.textViewArray = new TextView[this.width * this.height]; // get the table view to draw in it matrixTable = (TableLayout) findViewById(R.id.matrix_display_table); // traverse rows for (int i = 0; i < this.height; i++) { //traverse each element of the row tableRow = new TableRow(this); for (int j = 0; j < this.width; j++) { currentIndex = i * this.width + j; // this points to the location of t // editText in the matrix this.textViewArray[currentIndex] = new TextView(this); this.textViewArray[currentIndex] .setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); this.textViewArray[currentIndex].setPadding(5, 5, 5, 5); if (j == this.width - 1) { this.textViewArray[currentIndex].setText(" " + this.results[i]); } else { this.textViewArray[currentIndex].setText(" " + this.matrix[i][j]); } tableRow.addView(this.textViewArray[currentIndex]); } textViewArray[0].measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); // this will add target and position-specific views to hint the // user of what we are doing tableRow = decorateTableRow(tableRow, textViewArray[0].getMeasuredHeight(), textViewArray[0].getMeasuredWidth(), i); matrixTable.addView(tableRow, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); } }
From source file:com.example.diplimadoapp.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);// ww w . j av a 2 s.c o m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); switch (position) { case 0: LinearLayout ll = new LinearLayout(getActivity()); ll.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); ll.setOrientation(LinearLayout.VERTICAL); ImageView iv = new ImageView(getActivity()); iv.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 1020)); //iv.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); iv.setMaxHeight(520); iv.setImageResource(R.drawable.contact); ll.addView(iv); TableLayout tl = new TableLayout(getActivity()); tl.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TableRow tr = new TableRow(getActivity()); tr.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); tr.setGravity(Gravity.FILL_HORIZONTAL); tr.setPadding(5, 5, 5, 5); List<RssItem> lecturaitems = null; try { // Create RSS reader RssReader rssReader = new RssReader( "http://www.senalradionica.gov.co/index.php/home/articulos/itemlist?format=feed"); // Get a ListView from main view //ListView itcItems = (ListView) findViewById(R.id.listMainView); lecturaitems = rssReader.getItems(); } catch (Exception e) { Log.e("Diplomado App Reader", e.getMessage()); } TextView v1 = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v1.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); v1.setGravity(Gravity.CENTER); v1.setBackgroundResource(R.drawable.background_card); if (lecturaitems != null) { v1.setText(lecturaitems.get(0).getTitle()); String urlnoticia = lecturaitems.get(0).getLink(); v1.setOnClickListener(new NoticiaDestacadaOnClickListener(urlnoticia)); } else { v1.setText("No Registra nuevas noticias"); } tr.addView(v1); ImageButton ib = new ImageButton(getActivity()); ib.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1)); ib.setImageResource(R.drawable.facebook); ib.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW); myWebLink.setData(Uri.parse("http://www.facebook.com")); startActivity(myWebLink); } }); tr.addView(ib); ImageButton ib2 = new ImageButton(getActivity()); ib2.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1)); ib2.setImageResource(R.drawable.twitter); ib2.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW); myWebLink.setData(Uri.parse("http://www.twitter.com")); startActivity(myWebLink); } }); tr.addView(ib2); ImageButton ib3 = new ImageButton(getActivity()); ib3.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1)); ib3.setImageResource(R.drawable.youtube); ib3.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW); myWebLink.setData(Uri.parse("http://www.youtube.com")); startActivity(myWebLink); } }); tr.addView(ib3); tl.addView(tr); ll.addView(tl); fl.addView(ll); break; case 1: LinearLayout ll2 = new LinearLayout(getActivity()); ll2.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); ll2.setOrientation(LinearLayout.VERTICAL); TableLayout tl2 = new TableLayout(getActivity()); tl2.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TableRow tr2 = new TableRow(getActivity()); tr2.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); tr2.setGravity(Gravity.FILL_HORIZONTAL); tr2.setPadding(5, 5, 5, 5); TextView v0 = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v0.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); v0.setGravity(Gravity.CENTER); v0.setText("Acusticos Radionoca. Lunes a Viernes 8:00 a.m. - 9:00 a.m."); tr2.addView(v0); ImageButton ib20 = new ImageButton(getActivity()); ib20.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1)); ib20.setImageResource(R.drawable.pacusticos); ib20.setBackgroundDrawable(null); tr2.addView(ib20); tl2.addView(tr2); TableRow tr3 = new TableRow(getActivity()); tr3.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); tr3.setGravity(Gravity.FILL_HORIZONTAL); tr3.setPadding(5, 5, 5, 5); TextView v03 = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v03.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); v03.setGravity(Gravity.CENTER); v03.setText("Acusticos Radionoca. Lunes a Viernes 8:00 a.m. - 9:00 a.m."); tr3.addView(v03); ImageButton ib30 = new ImageButton(getActivity()); ib30.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1)); ib30.setImageResource(R.drawable.pradionica_lacarta); ib30.setBackgroundDrawable(null); tr3.addView(ib30); tl2.addView(tr3); TableRow tr4 = new TableRow(getActivity()); tr4.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); tr4.setGravity(Gravity.FILL_HORIZONTAL); tr4.setPadding(5, 5, 5, 5); TextView v04 = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v04.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); v04.setGravity(Gravity.CENTER); v04.setText("Acusticos Radionoca. Lunes a Viernes 8:00 a.m. - 9:00 a.m."); tr4.addView(v04); tl2.addView(tr4); ImageButton ib40 = new ImageButton(getActivity()); ib40.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1)); ib40.setImageResource(R.drawable.prockeros); ib40.setBackgroundDrawable(null); tr4.addView(ib40); ll2.addView(tl2); /* VideoView videoView = new VideoView(getActivity()); Uri path = Uri.parse("rtmp://cdns840stu0010.multistream.net:80/rtvcRadionicalive/?pass=|radionica|"); videoView.setVideoURI(path); videoView.start(); TableRow tr5 =new TableRow(getActivity()); tr5.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); tr5.setGravity(Gravity.FILL_HORIZONTAL); tr5.setPadding(5,5,5,5); tr5.addView(videoView); ll2.addView(tr5);*/ fl.addView(ll2); break; case 2: ListView lv = new ListView(getActivity()); params.setMargins(margin, margin, margin, margin); lv.setLayoutParams(params); lv.setLayoutParams(params); lv.setBackgroundResource(R.drawable.background_card); try { // Create RSS reader RssReader rssReader = new RssReader( "http://www.senalradionica.gov.co/index.php/home/articulos/itemlist?format=feed"); // Get a ListView from main view //ListView itcItems = (ListView) findViewById(R.id.listMainView); List<RssItem> lecturaitems2 = rssReader.getItems(); // Create a list adapter ArrayAdapter<RssItem> adapter = new ArrayAdapter<RssItem>(getActivity(), android.R.layout.simple_list_item_1, lecturaitems2); // Set list adapter for the ListView lv.setAdapter(adapter); // Set list view item click listener lv.setOnItemClickListener(new ListListener(lecturaitems2, getActivity())); } catch (Exception e) { Log.e("Diplomado App Reader", e.getMessage()); } fl.addView(lv); break; } return fl; }
From source file:com.vonglasow.michael.satstat.MainActivity.java
protected static void showCellGsm(CellTowerGsm cell) { TableRow row = new TableRow(rilCells.getContext()); row.setWeightSum(29);/*w w w .j a v a 2 s .c o m*/ TextView newType = new TextView(rilCells.getContext()); newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newType.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newType.setTextColor( rilCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration()))); newType.setText(rilCells.getContext().getResources().getString(R.string.smallDot)); row.addView(newType); TextView newMcc = new TextView(rilCells.getContext()); newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMcc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newMcc.setText(formatCellData(rilCells.getContext(), "%03d", cell.getMcc())); row.addView(newMcc); TextView newMnc = new TextView(rilCells.getContext()); newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMnc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newMnc.setText(formatCellData(rilCells.getContext(), "%02d", cell.getMnc())); row.addView(newMnc); TextView newLac = new TextView(rilCells.getContext()); newLac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5)); newLac.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newLac.setText(formatCellData(rilCells.getContext(), null, cell.getLac())); row.addView(newLac); TextView newCid = new TextView(rilCells.getContext()); newCid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9)); newCid.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newCid.setText(formatCellData(rilCells.getContext(), null, cell.getCid())); row.addView(newCid); TextView newPsc = new TextView(rilCells.getContext()); newPsc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newPsc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newPsc.setText(formatCellData(rilCells.getContext(), null, cell.getPsc())); row.addView(newPsc); TextView newDbm = new TextView(rilCells.getContext()); newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4)); newDbm.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newDbm.setText(formatCellDbm(rilCells.getContext(), null, cell.getDbm())); row.addView(newDbm); rilCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.vonglasow.michael.satstat.MainActivity.java
protected static void showCellCdma(CellTowerCdma cell) { TableRow row = new TableRow(rilCdmaCells.getContext()); row.setWeightSum(26);//from w w w. j ava 2s . c o m TextView newType = new TextView(rilCdmaCells.getContext()); newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newType.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newType.setTextColor( rilCdmaCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration()))); newType.setText(rilCdmaCells.getContext().getResources().getString(R.string.smallDot)); row.addView(newType); TextView newSid = new TextView(rilCdmaCells.getContext()); newSid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 6)); newSid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newSid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getSid())); row.addView(newSid); TextView newNid = new TextView(rilCdmaCells.getContext()); newNid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5)); newNid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newNid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getNid())); row.addView(newNid); TextView newBsid = new TextView(rilCdmaCells.getContext()); newBsid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9)); newBsid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newBsid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getBsid())); row.addView(newBsid); TextView newDbm = new TextView(rilCdmaCells.getContext()); newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4)); newDbm.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newDbm.setText(formatCellDbm(rilCdmaCells.getContext(), null, cell.getDbm())); row.addView(newDbm); rilCdmaCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }