本文整理了Java中android.widget.TableRow.addView()
方法的一些代码示例,展示了TableRow.addView()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableRow.addView()
方法的具体详情如下:
包路径:android.widget.TableRow
类名称:TableRow
方法名:addView
暂无
代码示例来源:origin: iSoron/uhabits
/**
* Appends a swatch to the end of the row for even-numbered rows (starting with row 0),
* to the beginning of a row for odd-numbered rows.
*/
private static void addSwatchToRow(TableRow row, View swatch, int rowNumber) {
if (rowNumber % 2 == 0) {
row.addView(swatch);
} else {
row.addView(swatch, 0);
}
}
代码示例来源:origin: firebase/firebase-jobdispatcher-android
private void addRow(TableLayout tableLayout, String text) {
TableRow tableRow = new TableRow(this);
TextView textView = new TextView(this);
textView.setText(text);
tableRow.addView(textView);
tableLayout.addView(tableRow);
}
}
代码示例来源:origin: Neamar/KISS
/**
* Appends a swatch to the end of the row for even-numbered rows (starting with row 0),
* to the beginning of a row for odd-numbered rows.
*/
private static void addSwatchToRow(TableRow row, View swatch, int rowNumber) {
if (rowNumber % 2 == 0) {
row.addView(swatch);
} else {
row.addView(swatch, 0);
}
}
代码示例来源:origin: willowtreeapps/Hyperion-Android
textView.setPadding(paddingPx, paddingPx / 2, paddingPx, paddingPx / 2);
textView.setTypeface(Typeface.DEFAULT_BOLD);
header.addView(textView);
row.addView(textView);
代码示例来源:origin: daliyan/MyKeep
/**
* Appends a swatch to the end of the row for even-numbered rows (starting with row 0),
* to the beginning of a row for odd-numbered rows.
*/
private static void addSwatchToRow(TableRow row, View swatch, int rowNumber) {
if (rowNumber % 2 == 0) {
row.addView(swatch);
} else {
row.addView(swatch, 0);
}
}
代码示例来源:origin: adrianchifor/Swiftnotes
/**
* Appends a swatch to the end of the row for even-numbered rows (starting with row 0),
* to the beginning of a row for odd-numbered rows
*/
private static void addSwatchToRow(TableRow row, View swatch, int rowNumber) {
if (rowNumber % 2 == 0) {
row.addView(swatch);
} else {
row.addView(swatch, 0);
}
}
代码示例来源:origin: consp1racy/android-support-preference
/**
* Appends a swatch to the end of the row for even-numbered rows (starting with row 0),
* to the beginning of a row for odd-numbered rows.
*/
private static void addSwatchToRow(@NonNull TableRow row, @NonNull View swatch, int rowNumber) {
if (rowNumber % 2 == 0) {
row.addView(swatch);
} else {
row.addView(swatch, 0);
}
}
代码示例来源:origin: qiubiteme/android_api_demos
private void appendRow(TableLayout table) {
TableRow row = new TableRow(this);
TextView label = new TextView(this);
label.setText(R.string.table_layout_7_quit);
label.setPadding(3, 3, 3, 3);
TextView shortcut = new TextView(this);
shortcut.setText(R.string.table_layout_7_ctrlq);
shortcut.setPadding(3, 3, 3, 3);
shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);
row.addView(label, new TableRow.LayoutParams(1));
row.addView(shortcut, new TableRow.LayoutParams());
table.addView(row, new TableLayout.LayoutParams());
}
}
代码示例来源:origin: THEONE10211024/ApiDemos
private void appendRow(TableLayout table) {
TableRow row = new TableRow(this);
TextView label = new TextView(this);
label.setText(R.string.table_layout_8_quit);
label.setPadding(3, 3, 3, 3);
TextView shortcut = new TextView(this);
shortcut.setText(R.string.table_layout_8_ctrlq);
shortcut.setPadding(3, 3, 3, 3);
shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);
row.addView(label, new TableRow.LayoutParams(1));
row.addView(shortcut, new TableRow.LayoutParams());
table.addView(row, new TableLayout.LayoutParams());
}
}
代码示例来源:origin: THEONE10211024/ApiDemos
private void appendRow(TableLayout table) {
TableRow row = new TableRow(this);
TextView label = new TextView(this);
label.setText(R.string.table_layout_7_quit);
label.setPadding(3, 3, 3, 3);
TextView shortcut = new TextView(this);
shortcut.setText(R.string.table_layout_7_ctrlq);
shortcut.setPadding(3, 3, 3, 3);
shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);
row.addView(label, new TableRow.LayoutParams(1));
row.addView(shortcut, new TableRow.LayoutParams());
table.addView(row, new TableLayout.LayoutParams());
}
}
代码示例来源:origin: qiubiteme/android_api_demos
private void appendRow(TableLayout table) {
TableRow row = new TableRow(this);
TextView label = new TextView(this);
label.setText(R.string.table_layout_8_quit);
label.setPadding(3, 3, 3, 3);
TextView shortcut = new TextView(this);
shortcut.setText(R.string.table_layout_8_ctrlq);
shortcut.setPadding(3, 3, 3, 3);
shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);
row.addView(label, new TableRow.LayoutParams(1));
row.addView(shortcut, new TableRow.LayoutParams());
table.addView(row, new TableLayout.LayoutParams());
}
}
代码示例来源:origin: iotoasis/SI
protected void appendRow( String value ){
// create table row
TableLayout tb = (TableLayout)findViewById(R.id.control_table_layout);
TableRow tableRow = new TableRow(this);
tableRow.setLayoutParams(tableLayout);
// get current time
long time = System.currentTimeMillis();
SimpleDateFormat dayTime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String cur_time = dayTime.format(new Date(time));
// set Text on TextView
TextView tv_left = new TextView(this);
tv_left.setText( cur_time );
tv_left.setLayoutParams( tableRowLayout );
tableRow.addView( tv_left );
TextView tv_right = new TextView(this);
tv_right.setText( value );
tv_right.setLayoutParams( tableRowLayout );
tableRow.addView( tv_right );
// set table rows on table
tb.addView(tableRow);
}
代码示例来源:origin: stackoverflow.com
for(IspHistoryListObject hl : historyList) {
count++;
TableRow tr = new TableRow(showRow.getContext());
LinearLayout ll = new LinearLayout(tr.getContext());
ll.setLayoutParams(new LinearLayout.LayoutParams(50,30));
TextView tv_sync_no = new TextView(ll.getContext());
TextView tv_sync_date = new TextView(ll.getContext());
TextView tv_sync_orderid = new TextView(ll.getContext());
TextView tv_sync_qty = new TextView(ll.getContext());
tv_sync_no.setText(String.valueOf(count));
tv_sync_date.setText(hl.getSyncDate().substring(0,10));
tv_sync_orderid.setText(hl.getSyncOrderIdRef());
tv_sync_qty.setText(String.valueOf(hl.getQty()));
ll.addView(tv_sync_no);
ll.addView(tv_sync_date);
ll.addView(tv_sync_orderid);
ll.addView(tv_sync_qty);
tr.addView(ll);
showRow.addView(tr);
}
代码示例来源:origin: pires/android-obd-reader
private void addTableRow(String id, String key, String val) {
TableRow tr = new TableRow(this);
MarginLayoutParams params = new ViewGroup.MarginLayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.setMargins(TABLE_ROW_MARGIN, TABLE_ROW_MARGIN, TABLE_ROW_MARGIN,
TABLE_ROW_MARGIN);
tr.setLayoutParams(params);
TextView name = new TextView(this);
name.setGravity(Gravity.RIGHT);
name.setText(key + ": ");
TextView value = new TextView(this);
value.setGravity(Gravity.LEFT);
value.setText(val);
value.setTag(id);
tr.addView(name);
tr.addView(value);
tl.addView(tr, params);
}
代码示例来源:origin: jorgegil96/All-NBA
private void addSeparatorRowToPlayers() {
TableRow row = new TableRow(getActivity());
row.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
View view = LayoutInflater.from(getActivity())
.inflate(R.layout.box_score_separator, row, false);
row.addView(view);
playersTable.addView(row, new TableLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
}
代码示例来源:origin: jorgegil96/All-NBA
public void displayTeamTotalStats(StatLine statLine){
TableRow row = new TableRow(getActivity());
row.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
row.addView(addNormalItem(row, String.valueOf(statLine.getMin())));
row.addView(addNormalItem(row, String.valueOf(statLine.getPts())));
row.addView(addNormalItem(row, String.valueOf(statLine.getReb())));
row.addView(addNormalItem(row, String.valueOf(statLine.getAst())));
row.addView(addNormalItem(row, String.valueOf(statLine.getStl())));
row.addView(addNormalItem(row, String.valueOf(statLine.getBlk())));
row.addView(addNormalItem(row, String.valueOf(statLine.getBlka())));
row.addView(addNormalItem(row, String.valueOf(statLine.getOreb())));
row.addView(addNormalItem(row, String.valueOf(statLine.getDreb())));
row.addView(addNormalItem(row, String.valueOf(statLine.getFgm())));
row.addView(addNormalItem(row, String.valueOf(statLine.getFga())));
row.addView(addNormalItem(row, getShootingPct(statLine.getFga(), statLine.getFgm())));
row.addView(addNormalItem(row, String.valueOf(statLine.getTpm())));
row.addView(addNormalItem(row, String.valueOf(statLine.getTpa())));
row.addView(addNormalItem(row, getShootingPct(statLine.getTpa(), statLine.getTpm())));
row.addView(addNormalItem(row, String.valueOf(statLine.getFtm())));
row.addView(addNormalItem(row, String.valueOf(statLine.getFta())));
row.addView(addNormalItem(row, getShootingPct(statLine.getFta(), statLine.getFtm())));
row.addView(addNormalItem(row, String.valueOf(statLine.getPf())));
row.addView(addNormalItem(row, String.valueOf(statLine.getTov())));
row.addView(addNormalItem(row, String.valueOf(statLine.getPm())));
statsTable.addView(row, new TableLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
}
代码示例来源:origin: jorgegil96/All-NBA
private void addSeparatorRowToStats(int columns) {
TableRow row = new TableRow(getActivity());
row.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
for (int i = 0; i < columns; i++) {
View view = LayoutInflater.from(getActivity())
.inflate(R.layout.box_score_separator, row, false);
row.addView(view);
}
statsTable.addView(row, new TableLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
}
代码示例来源:origin: stackoverflow.com
TableLayout table = (TableLayout)findViewById(R.id.scrollable_part);
int sourceColumnIndex = 0;
int targetColumnIndex = 1;
for (int i = 0; i < table.getChildCount(); i++)
{
TableRow tr = (TableRow)table.getChildAt(i);
View v = tr.getChildAt(sourceColumnIndex);
tr.removeViewAt(sourceColumnIndex);
tr.addView(v, targetColumnIndex);
}
代码示例来源:origin: jorgegil96/All-NBA
public void addRowToPlayersTable2(String content) {
TableRow row = new TableRow(getActivity());
row.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
int width = (int) UnitUtils.convertDpToPixel(100, getActivity());
row.setMinimumWidth(width);
if (content.equals("PLAYER")) {
TextView tv = addHeaderItem(row, content);
tv.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
row.addView(tv);
} else {
TextView tv = addNormalItem(row, content);
tv.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
row.addView(tv);
}
playersTable.addView(row, new TableLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
}
代码示例来源:origin: stackoverflow.com
TableLayout fixedColumnTable = (TableLayout) findViewById(R.id.fixed_column);
TableLayout table = (TableLayout)findViewById(R.id.scrollable_part);
if (table.getChildCount() == fixedColumnTable.getChildCount())
{
int fixedColumnIndex = 0;
int targetColumnIndex = 2;
for (int i = 0; i < table.getChildCount(); i++)
{
TableRow fixedTR = (TableRow)fixedColumnTable.getChildAt(i);
View fixedView = fixedTR.getChildAt(fixedColumnIndex);
TableRow targetTR = (TableRow)table.getChildAt(i);
View targetView = targetTR.getChildAt(targetColumnIndex);
fixedTR.removeViewAt(fixedColumnIndex);
targetTR.removeViewAt(targetColumnIndex);
fixedTR.addView(targetView, fixedColumnIndex);
targetTR.addView(fixedView, targetColumnIndex);
}
}
内容来源于网络,如有侵权,请联系作者删除!