本文整理匯總了Java中android.widget.TableRow.addView方法的典型用法代碼示例。如果您正苦於以下問題:Java TableRow.addView方法的具體用法?Java TableRow.addView怎麽用?Java TableRow.addView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.TableRow
的用法示例。
在下文中一共展示了TableRow.addView方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addChild
import android.widget.TableRow; //導入方法依賴的package包/類
private void addChild(AndroidViewComponent child) {
int row = child.Row();
int col = child.Column();
if (row == ComponentConstants.DEFAULT_ROW_COLUMN ||
col == ComponentConstants.DEFAULT_ROW_COLUMN) {
addChildLater(child);
} else {
if (row >= 0 && row < numRows) {
if (col >= 0 && col < numColumns) {
TableRow tableRow = (TableRow) layoutManager.getChildAt(row);
tableRow.removeViewAt(col);
View cellView = child.getView();
tableRow.addView(cellView, col, cellView.getLayoutParams());
} else {
Log.e("TableLayout", "Child has illegal Column property: " + child);
}
} else {
Log.e("TableLayout", "Child has illegal Row property: " + child);
}
}
}
示例2: showInfoGame
import android.widget.TableRow; //導入方法依賴的package包/類
public void showInfoGame(TableLayout table) {
table.removeAllViews();
if (mStateInfoGame == INFO_STATS) {
TextView textView;
mNumCols = measureNumColumns(table, getItem(0), mInfoBuilder.getItemStatsHeader());
mNumCols = Math.max(2, mNumCols);
mNumCols = Math.min(mNumCols, getSize() + 1);
mNumRows = (int)Math.ceil( (double)getSize() / (mNumCols - 1) );
TableRow row = new TableRow(mContext);
table.addView(row, TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);
for (int c = 0; c < mNumCols; c++) {
textView = createTextView(getColumn(c-1));
if (c > 0) textView.setGravity(Gravity.CENTER);
row.addView(textView, TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);
}
}
}
示例3: setNumRows
import android.widget.TableRow; //導入方法依賴的package包/類
void setNumRows(int newNumRows) {
if (newNumRows > numRows) {
// Add new rows
Context context = layoutManager.getContext();
for (int row = numRows; row < newNumRows; row++) {
TableRow tableRow = new TableRow(context);
for (int col = 0; col < numColumns; col++) {
tableRow.addView(newEmptyCellView(), col, newEmptyCellLayoutParams());
}
layoutManager.addView(tableRow, row, new android.widget.TableLayout.LayoutParams());
}
numRows = newNumRows;
} else if (newNumRows < numRows) {
// Remove extra rows
layoutManager.removeViews(newNumRows, numRows - newNumRows);
numRows = newNumRows;
}
}
示例4: addRow
import android.widget.TableRow; //導入方法依賴的package包/類
private void addRow(TableLayout parent, String key, String value) {
TableRow.LayoutParams rowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
TextView textViewKey = new TextView(this);
textViewKey.setText(key);
textViewKey.setLayoutParams(rowParams);
TextView textViewValue = new TextView(this);
textViewValue.setText(value);
textViewValue.setLayoutParams(rowParams);
TableRow tableRow = new TableRow(this);
tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
tableRow.addView(textViewKey);
tableRow.addView(textViewValue);
parent.addView(tableRow);
}
示例5: init
import android.widget.TableRow; //導入方法依賴的package包/類
private void init(Context context) {
TableRow tableRow = new TableRow(context);
tableRow.setGravity(Gravity.CENTER);
num1M = new NumberSpinner(context, digitSize);
num100K = new NumberSpinner(context, digitSize);
num10K = new NumberSpinner(context, digitSize);
num1K = new NumberSpinner(context, digitSize);
num100 = new NumberSpinner(context, digitSize);
num10 = new NumberSpinner(context, digitSize);
num1 = new NumberSpinner(context, digitSize);
if (numDigits >= 7) {
tableRow.addView(num1M);
}
if (numDigits >= 6) {
tableRow.addView(num100K);
}
if (numDigits >= 5) {
tableRow.addView(num10K);
}
if (numDigits >= 4) {
tableRow.addView(num1K);
}
if (numDigits >= 3) {
tableRow.addView(num100);
}
if (numDigits >= 2) {
tableRow.addView(num10);
}
tableRow.addView(num1);
// make everything disappear except the unit's place
num1M.setAlpha(0.0f);
num100K.setAlpha(0.0f);
num10K.setAlpha(0.0f);
num1K.setAlpha(0.0f);
num100.setAlpha(0.0f);
num10.setAlpha(0.0f);
this.setGravity(Gravity.CENTER);
this.addView(tableRow);
}
示例6: openResult
import android.widget.TableRow; //導入方法依賴的package包/類
private void openResult() {
mEmptyRefreshLayout.setVisibility(View.GONE);
mTabHeader.removeAllViews();
String[] array = getResources().getStringArray(R.array.add_column_result2);
TableRow myTabRow = new TableRow(mContext);
String columnName;
for (int i = 0; i < array.length; i++) {
columnName = array[i];
RightBorderTextView borderTextView = new RightBorderTextView(this, false);
borderTextView.setSingleLine(true);
borderTextView.setPadding(25, 10, 25, 10);
if ((i > 0 && i <= 5) || i > 9) {
borderTextView.setWidth(FeViewUtils.dpToPx(85));
} else {
borderTextView.setWidth(FeViewUtils.dpToPx(120));
}
borderTextView.setText(columnName);
myTabRow.addView(borderTextView);
borderTextView.setTextColor(getResources().getColor(R.color.table_head_text_color));
}
mTabHeader.setBackgroundColor(getResources().getColor(R.color.table_head_bg));
mTabHeader.addView(myTabRow);
mRecycleView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new SqlCreateViewAdapter(mNewColumnFieldList, array, this, isInformation);
mRecycleView.setAdapter(mAdapter);
}
示例7: addSwatchToRow
import android.widget.TableRow; //導入方法依賴的package包/類
/**
* 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);
}
}
示例8: makeRemarkList
import android.widget.TableRow; //導入方法依賴的package包/類
private void makeRemarkList(){
if(remarks.size() > 0){
tv_msg_remark.setVisibility(View.GONE);
}else{
tv_msg_remark.setVisibility(View.VISIBLE);
}
for(PatientRemark pr : remarks){
TableLayout.LayoutParams tlps=new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,TableLayout.LayoutParams.WRAP_CONTENT);
TableRow.LayoutParams trps=new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,TableRow.LayoutParams.WRAP_CONTENT);
TableRow tr = new TableRow(this);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
TextView tv_title = new TextView(this);
tv_title.setText(pr.getDescription());
tv_title.setLayoutParams(trps);
tv_title.setTextColor(getColorId(R.color.dark_gray));
tv_title.setGravity(Gravity.CENTER);
tv_title.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.default_font_small_size));
TextView tv_time = new TextView(this);
tv_time.setText(AdditionalFunc.getTimeString(pr.getRegisteredDate()));
tv_time.setLayoutParams(trps);
tv_time.setTextColor(getColorId(R.color.dark_gray));
tv_time.setGravity(Gravity.CENTER);
tv_time.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.default_font_small_size));
tr.addView(tv_title);
tr.addView(tv_time);
tl_remark.addView(tr, tlps);
}
}
示例9: addRow
import android.widget.TableRow; //導入方法依賴的package包/類
public void addRow() {
rows++;
TableRow tr = new TableRow(getContext());
tr.setLayoutParams(new MatrixView.LayoutParams(MatrixView.LayoutParams.WRAP_CONTENT, MatrixView.LayoutParams.WRAP_CONTENT, 1));
addView(tr);
for(int i = 0; i < columns; i++) {
tr.addView(createEditText());
}
}
示例10: addColumn
import android.widget.TableRow; //導入方法依賴的package包/類
public void addColumn() {
columns++;
for(int i = 0; i < rows; i++) {
TableRow tr = (TableRow) getChildAt(i);
tr.addView(createEditText());
}
}
示例11: addRowData
import android.widget.TableRow; //導入方法依賴的package包/類
private TableRow addRowData(List<String> data, int serialNumber) {
TableRow row = new TableRow(this);
row.addView(getCellView(Integer.toString(serialNumber)));
for (String cellValue : data) {
row.addView(getCellView(cellValue));
}
return row;
}
示例12: addButtonForNetwork
import android.widget.TableRow; //導入方法依賴的package包/類
private void addButtonForNetwork(AccessPointInfo info) {
TableLayout s = (TableLayout) findViewById(R.id.table_networks);
TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
TableRow row = new TableRow(this);
TableRow.LayoutParams rowParams = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
rowParams.gravity = Gravity.FILL_HORIZONTAL;
row.setPadding(10, 10, 10, 10);
row.setLayoutParams(rowParams);
row.setGravity(Gravity.FILL_HORIZONTAL);
row.setLayoutParams(rowParams);
NetworkButton button = new NetworkButton(this, info.getBssid());
TableRow.LayoutParams params = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
button.setLayoutParams(params);
button.setBackground(getResources().getDrawable(R.drawable.repwifi_button));
button.setTextColor(Commons.colorThemeLight);
button.setTextSize(20);
button.setPadding(25, 10, 25, 10);
button.setGravity(Gravity.CENTER_HORIZONTAL);
button.setText(info.getSsid(20));
button.setOnClickListener(this);
row.addView(button, params);
row.setGravity(Gravity.CENTER_HORIZONTAL);
s.addView(row, tableParams);
s.setGravity(Gravity.FILL_HORIZONTAL);
}
示例13: displayFoundUser
import android.widget.TableRow; //導入方法依賴的package包/類
private void displayFoundUser(final View view, final String name, final String email) {
if (view == null || name == null || name.equals("")) {
throw new IllegalArgumentException();
}
TableLayout table = (TableLayout) view.findViewById(R.id.table);
TableRow tableRow = new TableRow(this.getContext());
//tableRow.setBackgroundColor(getResources().getColor(R.color.colorAccent));
tableRow.setPadding(20, 20, 20, 5);
TableRow.LayoutParams layoutParams = new TableRow.LayoutParams();
layoutParams.setMargins(50, 40, 40, 40);
TextView nameTextView = new TextView(this.getContext());
nameTextView.setText(name);
nameTextView.setTextSize(22);
nameTextView.setTextColor(getResources().getColor(R.color.cast_expanded_controller_text_color));
nameTextView.setLayoutParams(layoutParams);
tableRow.addView(nameTextView);
tableRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((SideBarActivity) getActivity()).searchViewAsMenuItem.collapseActionView();
listener.onDisplayProfileFragmentInteraction(name, email);
}
});
table.addView(tableRow);
}
示例14: TableLayout
import android.widget.TableRow; //導入方法依賴的package包/類
/**
* Creates a new table layout.
*
* @param context view context
*/
TableLayout(Context context, int numColumns, int numRows) {
layoutManager = new android.widget.TableLayout(context);
this.numColumns = numColumns;
this.numRows = numRows;
handler = new Handler();
for (int row = 0; row < numRows; row++) {
TableRow tableRow = new TableRow(context);
for (int col = 0; col < numColumns; col++) {
tableRow.addView(newEmptyCellView(), col, newEmptyCellLayoutParams());
}
layoutManager.addView(tableRow, row, new android.widget.TableLayout.LayoutParams());
}
}
示例15: createTable
import android.widget.TableRow; //導入方法依賴的package包/類
/**
* @param activity Activity
* @param options Option[]
* @param owner Object
* @return TableRow
*/
public static TableRow createTable(Activity activity, Option[] options, Object owner)
{
TableRow tableRow = new TableRow(activity);
tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
//
LinearLayout linearLayout = new LinearLayout(activity);
linearLayout.setOrientation(LinearLayout.VERTICAL);
if (owner != null && (owner instanceof Transformer || owner instanceof Consumer))
{
//add divider
linearLayout.addView(Util.addDivider(activity));
}
TextView textViewName = new TextView(activity);
textViewName.setText(R.string.str_options);
textViewName.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
textViewName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
linearLayout.addView(textViewName);
//
LinearLayout linearLayoutOptions = new LinearLayout(activity);
linearLayoutOptions.setBackgroundColor(activity.getResources().getColor(R.color.colorListBorder));
linearLayoutOptions.setOrientation(LinearLayout.VERTICAL);
//options
for (int i = 0; i < options.length; i++)
{
if (options[i].isAssignableByString())
{
linearLayoutOptions.addView(addOption(activity, options[i], owner));
}
}
linearLayout.addView(linearLayoutOptions);
tableRow.addView(linearLayout);
return tableRow;
}