本文整理匯總了Java中android.widget.TableLayout.removeAllViews方法的典型用法代碼示例。如果您正苦於以下問題:Java TableLayout.removeAllViews方法的具體用法?Java TableLayout.removeAllViews怎麽用?Java TableLayout.removeAllViews使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.TableLayout
的用法示例。
在下文中一共展示了TableLayout.removeAllViews方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
}
示例2: onResume
import android.widget.TableLayout; //導入方法依賴的package包/類
@Override
protected void onResume() {
super.onResume();
pause = false;
mIsInForegroundMode = true;
StorageHandler.selfHandler.messagesView = this;
channel = getIntent().getStringExtra("channel");
setTitle(channel);
if (!isFromCompose) {
TableLayout tableMessages = (TableLayout) findViewById(R.id.tableMessages);
tableMessages.removeAllViews();
getItems();
}
//loadMsg();
}
示例3: 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));
}
}
}
示例4: 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));
}
}
示例5: updateUserInterface
import android.widget.TableLayout; //導入方法依賴的package包/類
@Override
protected void updateUserInterface() {
//Populate table
TableLayout header = findView(R.id.DisplayScoresTable_header);
TableLayout scoreboard = findView(R.id.DisplayScoresTable_table);
//remove potentially old views
header.removeAllViews();
scoreboard.removeAllViews();
ScoreBoardBuilder builder = new ScoreBoardBuilder(this, header, scoreboard);
builder.addHeader(session.getPlayers());
builder.addBody(session, session.getPlayers());
builder.build();
}
示例6: displayContact
import android.widget.TableLayout; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
private void displayContact(LayoutInflater inflater, View view) {
ImageView contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
if (contact.hasPhoto()) {
LinphoneUtils.setImagePictureFromUri(getActivity(), contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
} else {
contactPicture.setImageResource(R.drawable.avatar);
}
TextView contactName = (TextView) view.findViewById(R.id.contact_name);
contactName.setText(contact.getFullName());
TableLayout controls = (TableLayout) view.findViewById(R.id.controls);
controls.removeAllViews();
for (LinphoneNumberOrAddress noa : contact.getNumbersOrAddresses()) {
boolean skip = false;
View v = inflater.inflate(R.layout.contact_control_row, null);
String value = noa.getValue();
String displayednumberOrAddress = LinphoneUtils.getDisplayableUsernameFromAddress(value);
TextView label = (TextView) v.findViewById(R.id.address_label);
if (noa.isSIPAddress()) {
label.setText(R.string.sip_address);
skip |= getResources().getBoolean(R.bool.hide_contact_sip_addresses);
} else {
label.setText(R.string.phone_number);
skip |= getResources().getBoolean(R.bool.hide_contact_phone_numbers);
}
TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress);
tv.setText(displayednumberOrAddress);
tv.setSelected(true);
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
if (lpc != null) {
String username = lpc.normalizePhoneNumber(displayednumberOrAddress);
value = LinphoneUtils.getFullAddressFromUsername(username);
}
String contactAddress = contact.getPresenceModelForUri(noa.getValue());
if (contactAddress != null) {
v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE);
}
if (!displayChatAddressOnly) {
v.findViewById(R.id.contact_call).setOnClickListener(dialListener);
if (contactAddress != null) {
v.findViewById(R.id.contact_call).setTag(contactAddress);
} else {
v.findViewById(R.id.contact_call).setTag(value);
}
} else {
v.findViewById(R.id.contact_call).setVisibility(View.GONE);
}
v.findViewById(R.id.contact_chat).setOnClickListener(chatListener);
if (contactAddress != null) {
v.findViewById(R.id.contact_chat).setTag(contactAddress);
} else {
v.findViewById(R.id.contact_chat).setTag(value);
}
if (getResources().getBoolean(R.bool.disable_chat)) {
v.findViewById(R.id.contact_chat).setVisibility(View.GONE);
}
if (!skip) {
controls.addView(v);
}
}
}
示例7: clearChannelsList
import android.widget.TableLayout; //導入方法依賴的package包/類
private void clearChannelsList() {
TableLayout chatRoomsTable = (TableLayout) findViewById(R.id.chatRoomTable);
chatRoomsTable.removeAllViews();
}
示例8: setProperties
import android.widget.TableLayout; //導入方法依賴的package包/類
private void setProperties(ArrayList<FileMeta> properties) {
this.properties = properties;
if (properties == null) {
propertiesCard.setVisibility(View.GONE);
return;
}
if (propertiesCard.getVisibility() != View.VISIBLE) {
propertiesCard.setVisibility(View.VISIBLE);
}
Analytics.EventBuilder analytics = Analytics.newEvent("busybox properties");
for (FileMeta property : properties) {
analytics.put(property.label, property.value);
}
analytics.log();
TableLayout tableLayout = getViewById(R.id.table_properties);
if (tableLayout.getChildCount() > 0) {
tableLayout.removeAllViews();
}
int width = ResUtils.dpToPx(128);
int left = ResUtils.dpToPx(16);
int top = ResUtils.dpToPx(6);
int bottom = ResUtils.dpToPx(6);
int i = 0;
for (FileMeta meta : properties) {
TableRow tableRow = new TableRow(getActivity());
TextView nameText = new TextView(getActivity());
TextView valueText = new TextView(getActivity());
if (i % 2 == 0) {
tableRow.setBackgroundColor(0x0D000000);
} else {
tableRow.setBackgroundColor(Color.TRANSPARENT);
}
nameText.setLayoutParams(new TableRow.LayoutParams(width, ViewGroup.LayoutParams.WRAP_CONTENT));
nameText.setPadding(left, top, 0, bottom);
nameText.setAllCaps(true);
nameText.setTypeface(Typeface.DEFAULT_BOLD);
nameText.setText(meta.name);
valueText.setPadding(left, top, 0, bottom);
valueText.setText(meta.value);
tableRow.addView(nameText);
tableRow.addView(valueText);
tableLayout.addView(tableRow);
i++;
}
}
示例9: onOptionsItemSelected
import android.widget.TableLayout; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
final DBHelper db = new DBHelper(getApplicationContext());
switch (id) {
case R.id.action_backup:
String outFileName = Environment.getExternalStorageDirectory() + File.separator + getResources().getString(R.string.app_name) + File.separator;
performBackup(db, outFileName);
break;
case R.id.action_import:
performRestore(db);
break;
case R.id.action_backup_Drive:
bckORrst = true;
if (mGoogleApiClient != null)
mGoogleApiClient.disconnect();
mGoogleApiClient = gApiCLient(mGoogleApiClient);
mGoogleApiClient.connect();
break;
case R.id.action_import_Drive:
bckORrst = false;
if (mGoogleApiClient != null)
mGoogleApiClient.disconnect();
mGoogleApiClient = gApiCLient(mGoogleApiClient);
mGoogleApiClient.connect();
break;
case R.id.action_delete_all:
//reinitialize the backup
SQLiteDatabase database = db.getWritableDatabase();
db.onUpgrade(database, getDatabaseVersion(), getDatabaseVersion());
TableLayout table = (TableLayout) findViewById(R.id.table);
table.removeAllViews();
break;
default:
break;
}
return super.onOptionsItemSelected(item);
}
示例10: updateStaticPanelData
import android.widget.TableLayout; //導入方法依賴的package包/類
private void updateStaticPanelData(Module module) {
TextView moduleName = (TextView) findViewById(R.id.static_module_name);
moduleName.setText(module.getName());
TextView moduleDescription = (TextView) findViewById(R.id.static_module_description);
if (module.getDescription() == null || module.getDescription().isEmpty()) {
moduleDescription.setVisibility(View.GONE);
} else {
moduleDescription.setVisibility(View.VISIBLE);
moduleDescription.setText(module.getDescription());
}
TableLayout dataTable = (TableLayout) findViewById(R.id.module_static_data);
dataTable.removeAllViews();
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (NameValuePair dataItem : module.getStaticData()) {
TableRow rowView = (TableRow) inflater.inflate(R.layout.static_module_data_row, null);
TextView label = (TextView) rowView.findViewById(R.id.static_data_label);
label.setText(dataItem.getName());
TextView value = (TextView) rowView.findViewById(R.id.static_data_value);
value.setText(dataItem.getValue());
dataTable.addView(rowView);
}
TextView moduleVersion = (TextView) findViewById(R.id.static_module_version);
if (module.getVersion() == null || module.getVersion().isEmpty()) {
((TextView)findViewById(R.id.static_module_version_label)).setVisibility(View.GONE);
moduleVersion.setVisibility(View.GONE);
} else {
((TextView)findViewById(R.id.static_module_version_label)).setVisibility(View.VISIBLE);
moduleVersion.setVisibility(View.VISIBLE);
moduleVersion.setText(module.getVersion());
}
TextView moduleServer = (TextView) findViewById(R.id.static_module_server);
if (module.getHost() == null || module.getHost().isEmpty()) {
((TextView)findViewById(R.id.static_module_server_label)).setVisibility(View.GONE);
moduleServer.setVisibility(View.GONE);
} else {
((TextView)findViewById(R.id.static_module_server_label)).setVisibility(View.VISIBLE);
moduleServer.setVisibility(View.VISIBLE);
moduleServer.setText(module.getHost());
}
}
示例11: setUpPropertiesForFlight
import android.widget.TableLayout; //導入方法依賴的package包/類
private void setUpPropertiesForFlight() {
LayoutInflater l = getActivity().getLayoutInflater();
TableLayout tl = (TableLayout) findViewById(R.id.tblPinnedProperties);
if (tl == null)
return;
tl.removeAllViews();
if (m_le == null)
return;
m_le.SyncProperties();
if (m_le.rgCustomProperties == null)
return;
HashSet<Integer> pinnedProps = CustomPropertyType.getPinnedProperties(getActivity().getSharedPreferences(CustomPropertyType.prefSharedPinnedProps, Activity.MODE_PRIVATE));
CustomPropertyType[] rgcptAll = CustomPropertyTypesSvc.getCachedPropertyTypes();
if (rgcptAll == null)
return;
FlightProperty[] rgProps = FlightProperty.CrossProduct(m_le.rgCustomProperties, rgcptAll);
for (FlightProperty fp : rgProps) {
if (fp.CustomPropertyType() == null)
fp.RefreshPropType();
Boolean fIsPinned = CustomPropertyType.isPinnedProperty(pinnedProps, fp.idPropType);
if (!fIsPinned && fp.IsDefaultValue())
continue;
TableRow tr = (TableRow) l.inflate(R.layout.cpttableitem, tl, false);
tr.setId(View.generateViewId());
PropertyEdit pe = tr.findViewById(R.id.propEdit);
pe.InitForProperty(fp, tr.getId(), this, this);
tr.findViewById(R.id.imgFavorite).setVisibility(fIsPinned ? View.VISIBLE : View.INVISIBLE);
tl.addView(tr, new TableLayout.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
}
}