本文整理了Java中android.widget.TableRow
类的一些代码示例,展示了TableRow
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableRow
类的具体详情如下:
包路径:android.widget.TableRow
类名称:TableRow
暂无
代码示例来源:origin: willowtreeapps/Hyperion-Android
private List<TableRow> getTableRows(Context context, Cursor cursor) {
TableRow header = new TableRow(context);
cursor.moveToFirst();
TextView textView = new TextView(context);
textView.setText(cursor.getColumnName(col));
textView.setPadding(paddingPx, paddingPx / 2, paddingPx, paddingPx / 2);
textView.setTypeface(Typeface.DEFAULT_BOLD);
header.addView(textView);
TableRow row = new TableRow(context);
for (int col = 0; col < cursor.getColumnCount(); col++) {
TextView textView = new TextView(context);
textView.setBackgroundColor(context.getResources().getColor(rowBgRes));
row.addView(textView);
代码示例来源:origin: iSoron/uhabits
private TableRow createTableRow() {
TableRow row = new TableRow(getContext());
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
row.setLayoutParams(params);
return row;
}
代码示例来源:origin: stackoverflow.com
for(int i=0;i<3;i++)
{
TableRow row = (TableRow)tblLayout.getChildAt(i);
for(int j=0;j<3;j++){
Button button = (Button)row.getChildAt(j); // get child index on particular row
String buttonText = button.getText().toString();
Log.i("Button index: "+(i+j), buttonText);
}
}
代码示例来源: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: 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: WowzaMediaSystems/gocoder-sdk-samples-android
private void addSubSectionFooter(TableLayout table, String label) {
TableRow row = new TableRow(getActivity());
TableRow.LayoutParams rowParams = new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
row.setLayoutParams(rowParams);
TextView dataLabel = new TextView(getActivity());
//dataLabel.setText(label);
//dataLabel.setTextAppearance(getActivity(), R.style.DataTableLabelAppearance);
dataLabel.setPadding( 15, 15, 15, 15);
//TableRow.LayoutParams labelParams = new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//TableRow.LayoutParams labelParams = new TableRow.LayoutParams(1);
//labelParams.weight = 1.0f;
//labelParams.gravity = Gravity.END;
//dataLabel.setLayoutParams(labelParams);
TextView dataValue = new TextView(getActivity());
dataValue.setText("}" + (label != null ? " (" + label + ")" : ""));
dataValue.setTextAppearance(getActivity(), R.style.DataTableLabelAppearance);
dataValue.setPadding( 15, 15, 15, 15);
TableRow.LayoutParams valueParams = new TableRow.LayoutParams(2);
valueParams.weight = 1.0f;
dataValue.setLayoutParams(valueParams);
row.addView(dataLabel);
row.addView(dataValue);
setRowBackground(row);
table.addView(row);
}
代码示例来源:origin: renyuneyun/Easer
void bindTo(@Nullable ActivityLog activityLog) {
binding.cScript.setVisibility(View.GONE);
binding.cStatus.setVisibility(View.GONE);
binding.cProfile.setVisibility(View.GONE);
binding.cService.setVisibility(View.GONE);
binding.cTime.setVisibility(View.GONE);
binding.cExtra.setVisibility(View.GONE);
if (activityLog == null)
return;
long loadTime = activityLog.time();
binding.cTime.setVisibility(View.VISIBLE);
binding.tvTime.setText(tLong2Text(loadTime, context.get()));
String extraInfo = activityLog.extraInfo();
if (extraInfo != null) {
binding.cExtra.setVisibility(View.VISIBLE);
binding.tvExtra.setText(extraInfo);
binding.cScript.setVisibility(View.VISIBLE);
binding.tvScript.setText(scriptName);
final String profileName = (log).getProfileName();
if (profileName != null) {
binding.cProfile.setVisibility(View.VISIBLE);
binding.cStatus.setVisibility(View.VISIBLE);
ProfileLoadedLog log = (ProfileLoadedLog) activityLog;
final String profileName = (log).getProfileName();
binding.cProfile.setVisibility(View.VISIBLE);
final String serviceName = log.getServiceName();
代码示例来源:origin: marzika/Snapprefs
(TableLayout) ((LinearLayout) XposedHelpers.getObjectField(param.thisObject, "z")).getChildAt(0);//prev. C
ImageView orig =
(ImageView) ((TableRow) navigation.getChildAt(0)).getChildAt(0);
TextView orig1 =
(TextView) ((TableRow) navigation.getChildAt(0)).getChildAt(1);
TableRow row = new TableRow(navigation.getContext());
row.setTag("Snapprefs Link");
row.setLayoutParams(navigation.getChildAt(0).getLayoutParams());
ImageView iv = new ImageView(navigation.getContext());
iv.setImageDrawable(mResources.getDrawable(R.drawable.profile_snapprefs));
iv.setLayoutParams(orig.getLayoutParams());
TextView textView = new TextView(navigation.getContext());
textView.setText("Open Snapprefs");
textView.setTextColor(orig1.getCurrentTextColor());
textView.setTextSize(24);
textView.setLayoutParams(orig1.getLayoutParams());
row.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
row.addView(iv);
row.addView(textView);
navigation.addView(row);
代码示例来源:origin: stackoverflow.com
tr1.setId(id);
tr1.setClickable(true);
tr1.setOnClickListener(new View.OnClickListener(){
for(int i = 0;i<lytTableData.getChildCount();i++){
TableRow vi2 = (TableRow) lytTableData.getChildAt(i);
vi2.getChildAt(4).setVisibility(View.INVISIBLE);
vi.getChildAt(4).setVisibility(View.VISIBLE);
tr1.setLayoutParams(new LayoutParams( LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
TextView textViewItemName,textViewItemPrice;
textViewItemName= new TextView(this);textViewItemQuantity= new EditText(this);textViewItemPrice= new TextView(this);textViewItemAmount= new TextView(this);
iv2 = new ImageView(this);
textViewItemName.setWidth(500);textViewItemQuantity.setWidth(100);textViewItemPrice.setWidth(100);textViewItemAmount.setWidth(100);
tr1.addView(textViewItemName);tr1.addView(textViewItemQuantity);tr1.addView(textViewItemPrice);tr1.addView(textViewItemAmount);tr1.addView(iv2);
lytTableData.addView(tr1, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
System.out.println(tr1.getId());
代码示例来源:origin: firelotus/Meteorite
final TableRow tableRow = new TableRow(getApplicationContext());
tableRow.setBackgroundColor(Color.BLACK);
tableRow.setPadding(0, 2, 0, 2);
cell.setBackgroundColor(Color.WHITE);
cell.setLayoutParams(tableRowParams);
final TextView columsView = new TextView(getApplicationContext());
String column_data = "";
try{
columsView.setText(column_data);
columsView.setTextColor(Color.parseColor("#000000"));
columsView.setPadding(0, 0, 4, 3);
cell.addView(columsView);
tableRow.addView(cell);
tableRow.setVisibility(View.VISIBLE);
currentrow=currentrow+1;
tableRow.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
代码示例来源:origin: firelotus/Meteorite
tableRow.setVisibility(View.VISIBLE);
for(int j=0;j<tableRow.getChildCount();j++)
LinearLayout llcolumn = (LinearLayout) tableRow.getChildAt(j);
TextView columsView =(TextView)llcolumn.getChildAt(0);
columsView.setText(""+c3.getString(j));
tableRow.setVisibility(View.GONE);
代码示例来源:origin: stackoverflow.com
db = (new HighscoreDB(this)).getWritableDatabase();
cur = db.rawQuery("SELECT _id, name, score FROM highscore ORDER BY score DESC", null);
int noOfScorer=0;
cur.moveToFirst();
while ((!cur.isAfterLast())&&noOfScorer<11)
{
noOfScorer++;
TableRow row = (TableRow)mHighscoreTable.getChildAt(noOfScorer);
TextView tvName = (TextView)row.getChildAt(1);
TextView tvScore = (TextView)row.getChildAt(2);
tvName.setText(cur.getString(1));
tvScore.setText(Integer.toString(cur.getInt(2)));
cur.moveToNext();
}
代码示例来源:origin: ImmortalZ/jellyball
public void showTable() {
TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT,
TableRow.LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.CENTER;
layoutParams.leftMargin = 30;
layoutParams.bottomMargin = 10;
layoutParams.topMargin = 10;
for (int i = 0; i < 30; i++) {
TableRow tableRow = new TableRow(this);
TextView textView = new TextView(this);
textView.setText("Test pull down scroll view " + i);
textView.setTextSize(20);
textView.setPadding(15, 15, 15, 15);
tableRow.addView(textView, layoutParams);
if (i % 2 != 0) {
tableRow.setBackgroundColor(Color.LTGRAY);
} else {
tableRow.setBackgroundColor(Color.WHITE);
}
final int n = i;
tableRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Click item " + n, Toast.LENGTH_SHORT).show();
}
});
mMainLayout.addView(tableRow);
}
}
代码示例来源: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: 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: TobiasBielefeld/Simple-Solitaire
textViewAppVersion.setText(stringFormat(BuildConfig.VERSION_NAME));
textViewBuildDate.setText(stringFormat(buildDate));
textView.setMovementMethod(LinkMovementMethod.getInstance());
for (int j = 1; j < row.getChildCount(); j++)
TextView text = (TextView) row.getChildAt(j);
text.setMovementMethod(LinkMovementMethod.getInstance());
for (int j = 0; j < row.getChildCount(); j++)
TextView text = (TextView) row.getChildAt(j);
text.setMovementMethod(LinkMovementMethod.getInstance());
代码示例来源:origin: shrikanth7698/Collapsible-Calendar-View-Android
mTxtTitle.setText(formattedDate);
mTableHead.removeAllViews();
mTableBody.removeAllViews();
R.string.saturday
};
rowCurrent = new TableRow(mContext);
rowCurrent.setLayoutParams(new TableLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
View view = mInflater.inflate(R.layout.layout_day_of_week, null);
TextView txtDayOfWeek = (TextView) view.findViewById(R.id.txt_day_of_week);
txtDayOfWeek.setText(dayOfWeekIds[(i + getFirstDayOfWeek().getValue()) % 7]);
view.setLayoutParams(new TableRow.LayoutParams(
0,
ViewGroup.LayoutParams.WRAP_CONTENT,
1));
rowCurrent.addView(view);
rowCurrent = new TableRow(mContext);
rowCurrent.setLayoutParams(new TableLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
rowCurrent.addView(view);
代码示例来源: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: stackoverflow.com
//...
tr.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
TableRow t = (TableRow) view;
TextView firstTextView = (TextView) t.getChildAt(0);
TextView secondTextView = (TextView) t.getChildAt(1);
String firstText = firstTextView.getText().toString();
String secondText = secondTextView.getText().toString();
}
});
//...
代码示例来源:origin: oliexdev/openScale
private void initView(Context context) {
measurementRow = new TableRow(context);
evaluatorRow = new TableRow(context);
evaluatorView = new LinearGaugeView(context);
measurementRow.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT, 1.0f));
measurementRow.setGravity(Gravity.CENTER);
measurementRow.addView(iconView);
measurementRow.addView(nameView);
measurementRow.addView(valueView);
measurementRow.addView(incDecLayout);
measurementRow.addView(editModeView);
measurementRow.addView(indicatorView);
iconView.setColorFilter(getForegroundColor());
nameView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
nameView.setLines(2);
nameView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.55f));
indicatorView.setBackgroundColor(Color.GRAY);
evaluatorRow.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT, 1.0f));
evaluatorRow.addView(new Space(context));
evaluatorRow.addView(evaluatorView);
Space spaceAfterEvaluatorView = new Space(context);
evaluatorRow.addView(spaceAfterEvaluatorView);
evaluatorRow.setVisibility(View.GONE);
内容来源于网络,如有侵权,请联系作者删除!