本文整理汇总了Java中android.widget.TableLayout.addView方法的典型用法代码示例。如果您正苦于以下问题:Java TableLayout.addView方法的具体用法?Java TableLayout.addView怎么用?Java TableLayout.addView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TableLayout
的用法示例。
在下文中一共展示了TableLayout.addView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerNotification
import android.widget.TableLayout; //导入方法依赖的package包/类
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
tr = new GenericTabRow(con);
tr.sl1.autoScale = true;
tr.sl1.autoScaleBounceBack = true;
tr.sl1.setColor(255, 0, 150, 125);
tr.sl1.maxVal = 100;
tr.sl1.minVal = 0;
tr.setIcon("sensortag2", "barometer");
tr.title.setText("Barometer Data");
tr.uuidLabel.setText(GattData);
tr.value.setText("0.0mBar, 0.0m");
tr.periodBar.setProgress(100);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
super.registerNotificationImp(bytes -> {
convertRaw(bytes);
double h = ((baro/100.0)/PA_PER_METER - 70.0);
tr.value.setText(String.format("%.1f mBar %.1f meter", baro/100.0, h));
tr.sl1.addValue(baro);
if (DBG)
Log.d(TAG, "Baro:" + baro);
});
return false;
}
示例2: registerNotification
import android.widget.TableLayout; //导入方法依赖的package包/类
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
tr = new GenericTabRow(con);
tr.sl1.autoScale = true;
tr.sl1.autoScaleBounceBack = true;
tr.sl1.setColor(255, 0, 150, 125);
tr.sl1.maxVal = 100;
tr.sl1.minVal = 0;
tr.setIcon("sensortag2", "humidity");
tr.title.setText("Humidity Data");
tr.uuidLabel.setText(GattData);
tr.value.setText("0.0%rH");
tr.periodBar.setProgress(100);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
super.registerNotificationImp(bytes -> {
convertRaw(bytes);
tr.value.setText(String.format("%.1f %%rH", humidity));
tr.sl1.addValue(humidity);
if (DBG)
Log.d(TAG, "Humidity:" + humidity);
});
return false;
}
示例3: registerNotification
import android.widget.TableLayout; //导入方法依赖的package包/类
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
tr = new GenericTabRow(con);
tr.sl1.autoScale = true;
tr.sl1.autoScaleBounceBack = true;
tr.sl1.setColor(255, 0, 150, 125);
tr.setIcon("sensortag2", "lightsensor");
tr.title.setText("Luxometer Data");
tr.uuidLabel.setText(GattData);
tr.value.setText("0.0 Lux");
tr.periodBar.setProgress(100);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
super.registerNotificationImp(bytes -> {
convertRaw(bytes);
tr.value.setText(String.format("%.1f Lux", lux));
tr.sl1.addValue(lux);
if (DBG)
Log.d(TAG, "Lux:" + lux);
});
return false;
}
示例4: registerNotification
import android.widget.TableLayout; //导入方法依赖的package包/类
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
SimpleKeyTabRow tr = new SimpleKeyTabRow(con);
tr.setId(parenet.generateViewId());
tr.setIcon("sensortag2", "simplekeys");
tr.title.setText("Key press state");
tr.uuidLabel.setText(GattData);
tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
super.registerNotificationImp( bytes -> {
convertRaw(bytes);
tr.leftKeyPressState.setImageResource(isLeftKey() ? R.drawable.leftkeyon_300 : R.drawable.leftkeyoff_300);
tr.rightKeyPressState.setImageResource(isRightKey() ? R.drawable.rightkeyon_300 : R.drawable.rightkeyoff_300);
tr.reedState.setImageResource(isReed() ? R.drawable.reedrelayon_300 : R.drawable.reedrelayoff_300);
tr.lastKeys = keyState;
if (DBG)
Log.d(TAG, "Left key:" + getKeyState(true) + ", " +
"Right key:" + getKeyState(false));
});
return true;
}
示例5: showInfoGame
import android.widget.TableLayout; //导入方法依赖的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);
}
}
}
示例6: addRow
import android.widget.TableLayout; //导入方法依赖的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);
}
示例7: onCreateView
import android.widget.TableLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.ingredients_fragment, container, false);
this.recipe = ((RecipeActivity) getActivity()).mRecipe;
TableLayout table = (TableLayout) rootView.findViewById(R.id.ingredientsTable);
for (Recipe.Ingredient ingredient : recipe.getIngredients()) {
TableRow row = (TableRow) inflater.inflate(R.layout.ingredients_row, null);
((TextView) row.findViewById(R.id.attrib_name)).setText(ingredient.getAmount());
((TextView) row.findViewById(R.id.attrib_value)).setText(ingredient
.getDescription());
table.addView(row);
}
return rootView;
}
示例8: appendRowInfo
import android.widget.TableLayout; //导入方法依赖的package包/类
private void appendRowInfo(TableLayout table, String key, String value) {
TableRow row = (TableRow) this.getLayoutInflater().inflate(R.layout
.pokemon_info_table_row, null);
((TextView) row.findViewById(R.id.attrib_name)).setText(key);
((TextView) row.findViewById(R.id.attrib_value)).setText(value);
table.addView(row);
}
示例9: appendRowBaseStat
import android.widget.TableLayout; //导入方法依赖的package包/类
private void appendRowBaseStat(TableLayout table, String key, int value) {
TableRow row = (TableRow) this.getLayoutInflater().inflate(R.layout
.pokemon_base_stat_table_row, null);
((TextView) row.findViewById(R.id.attrib_name)).setText(key);
((TextView) row.findViewById(R.id.attrib_value)).setText(String.valueOf(value));
((ProgressBar) row.findViewById(R.id.progressbar_stat)).setProgress(value);
table.addView(row);
}
示例10: onCreateView
import android.widget.TableLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.coin_layout, container, false);
if (Cache.topDivs == null || Cache.topDivs.equals("")) return rootView;
TableLayout tl = (TableLayout) rootView.findViewById(R.id.item_table);
try {
JSONObject obj = new JSONObject(Cache.bottomDivs);
Iterator<String> keys = obj.keys();
while (keys.hasNext()) {
String key = keys.next();
String market = key.split("-")[0];
if (!market.contains("btc")) continue;
String strType = key.split("-")[1];
TableLayout tlx = (TableLayout) inflater.inflate(R.layout.item_layout, container, false);
TextView level = (TextView) tlx.findViewById(R.id.level);
TextView reliability = (TextView) tlx.findViewById(R.id.reliability);
TextView time = (TextView) tlx.findViewById(R.id.div_time);
level.setText(strType);
reliability.setText(obj.getJSONObject(key).getDouble("reliability") + "");
time.setText(obj.getJSONObject(key).getString("cur_div_time"));
tl.addView(tlx);
}
} catch (JSONException e) {
e.printStackTrace();
}
return rootView;
}
示例11: BindTable
import android.widget.TableLayout; //导入方法依赖的package包/类
private void BindTable() {
TableLayout tl = (TableLayout) findViewById(R.id.tblCurrency);
if (tl == null)
throw new NullPointerException("tl is null in BindTable (ActCurrency)!");
tl.removeAllViews();
LayoutInflater l = getActivity().getLayoutInflater();
if (m_rgcsi == null)
return;
for (CurrencyStatusItem csi : m_rgcsi) {
try {
// TableRow tr = new TableRow(this);
TableRow tr = (TableRow) l.inflate(R.layout.currencyrow, tl, false);
TextView tvAttribute = tr.findViewById(R.id.txtCsiAttribute);
TextView tvValue = tr.findViewById(R.id.txtCsiValue);
TextView tvDiscrepancy = tr.findViewById(R.id.txtCsiDiscrepancy);
tvAttribute.setText(csi.Attribute);
tvValue.setText(csi.Value);
tvDiscrepancy.setText(csi.Discrepancy);
if (csi.Discrepancy.length() == 0)
tvDiscrepancy.setVisibility(View.GONE);
tvAttribute.setTextColor(Color.BLACK);
tvDiscrepancy.setTextColor(Color.BLACK);
if (csi.Status.compareTo("NotCurrent") == 0)
tvValue.setTextColor(Color.RED);
else if (csi.Status.compareTo("GettingClose") == 0)
tvValue.setTextColor(Color.BLUE);
else
tvValue.setTextColor(Color.argb(255, 0, 128, 0));
tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
} catch (NullPointerException ex) { // should never happen.
Log.e(MFBConstants.LOG_TAG, Log.getStackTraceString(ex));
}
}
}
示例12: addButtonForNetwork
import android.widget.TableLayout; //导入方法依赖的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.TableLayout; //导入方法依赖的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: addRow
import android.widget.TableLayout; //导入方法依赖的package包/类
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);
}
示例15: createPlayerOverviewArea
import android.widget.TableLayout; //导入方法依赖的package包/类
private void createPlayerOverviewArea(TableLayout panel) {
//remove all old child views before adding the latest ones
panel.removeAllViews();
SingleGameResult latestGame = session.getLatestResult();
for (Player player : session.getPlayers()) {
PlayerRole role = null;
if (latestGame != null) {
role = latestGame.findRole(player);
}
panel.addView(new PlayerScoreOverwievBuilder(new PlayerScoreEntry(player, role)).build(this));
}
}