本文整理汇总了Java中android.widget.TableRow.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java TableRow.findViewById方法的具体用法?Java TableRow.findViewById怎么用?Java TableRow.findViewById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TableRow
的用法示例。
在下文中一共展示了TableRow.findViewById方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFocusToSpecific
import android.widget.TableRow; //导入方法依赖的package包/类
public CustomEditText setFocusToSpecific(CustomEditText customEditText) {
TableRow tableRow = (TableRow) customEditText.getParent();
TableLayout tableLayout = (TableLayout) tableRow.getParent();
int indexOnTable = tableLayout.indexOfChild(tableRow);
if (indexOnTable == 0) {
//what if index is 0, get the previous on edittext
}
TableRow prevRow = (TableRow) tableLayout.getChildAt(indexOnTable - 1);
if (prevRow != null) {
CustomEditText editText = (CustomEditText) tableRow.findViewById(R.id.txtText);
if (editText.requestFocus()) {
editText.setSelection(editText.getText().length());
}
return editText;
}
return null;
}
示例2: BindTable
import android.widget.TableRow; //导入方法依赖的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));
}
}
}
示例3: rearrangeColumns
import android.widget.TableRow; //导入方法依赖的package包/类
private void rearrangeColumns(TableLayout _table) {
//TODO, make sure that if OL, all the items are ordered numerically
for (int i = 0; i < _table.getChildCount(); i++) {
TableRow tableRow = (TableRow) _table.getChildAt(i);
TextView _bullet = (TextView) tableRow.findViewById(R.id.lblOrder);
_bullet.setText(String.valueOf(i + 1) + ".");
}
}
示例4: validateAndRemoveLisNode
import android.widget.TableRow; //导入方法依赖的package包/类
public void validateAndRemoveLisNode(View view, EditorControl contentType) {
/*
*
* If the person was on an active ul|li, move him to the previous node
*
*/
TableRow _row = (TableRow) view.getParent();
TableLayout _table = (TableLayout) _row.getParent();
int indexOnList = _table.indexOfChild(_row);
_table.removeView(_row);
if (indexOnList > 0) {
/**
* check if the index of the deleted row is <0, if so, move the focus to the previous li
*/
TableRow focusrow = (TableRow) _table.getChildAt(indexOnList - 1);
EditText text = (EditText) focusrow.findViewById(R.id.txtText);
/**
* Rearrange the nodes
*/
if (contentType.Type == EditorType.OL_LI) {
rearrangeColumns(_table);
}
if (text.requestFocus()) {
text.setSelection(text.getText().length());
}
} else {
/**
* The removed row was first on the list. delete the list, and set the focus to previous element on the editor
*/
editorCore.removeParent(_table);
}
}
示例5: setFocusToList
import android.widget.TableRow; //导入方法依赖的package包/类
public void setFocusToList(View view, int position) {
TableLayout tableLayout = (TableLayout) view;
int count = tableLayout.getChildCount();
if (tableLayout.getChildCount() > 0) {
TableRow tableRow = (TableRow) tableLayout.getChildAt(position == POSITION_START ? 0 : count - 1);
if (tableRow != null) {
EditText editText = (EditText) tableRow.findViewById(R.id.txtText);
if (editText.requestFocus()) {
editText.setSelection(editText.getText().length());
}
}
}
}
示例6: DisplayInfo
import android.widget.TableRow; //导入方法依赖的package包/类
public DisplayInfo(MonitoredSensor sensor, TableRow row) {
mSensor = sensor;
// Initialize displayed checkbox for this sensor, and register
// checked state listener for it.
mChk = (CheckBox) row.findViewById(R.id.row_checkbox);
mChk.setText(sensor.getUiName());
mChk.setEnabled(sensor.isEnabledByEmulator());
mChk.setChecked(sensor.isEnabledByUser());
mChk.setOnCheckedChangeListener(this);
// Initialize displayed text box for this sensor.
mVal = (TextView) row.findViewById(R.id.row_textview);
mVal.setText(sensor.getValue());
}
示例7: initPositiveIntValue
import android.widget.TableRow; //导入方法依赖的package包/类
/**
* Initialise NumberPicker and button to view/edit a integer between 0 and Constants.MAX_INT_AGE
* @param tableRow
* @param value
*/
private void initPositiveIntValue(TableRow tableRow, Value value){
Button button=(Button)tableRow.findViewById(R.id.dynamic_positiveInt_btn);
final EditText numberPicker = (EditText)tableRow.findViewById(R.id.dynamic_positiveInt_edit);
//Without setMinValue, setMaxValue, setValue in this order, the setValue is not displayed in the screen.
numberPicker.setFilters(new InputFilter[]{
new InputFilter.LengthFilter(Constants.MAX_INT_CHARS),
new MinMaxInputFilter(0, 99)
});
//Has value? show it
if(value!=null){
numberPicker.setText(value.getValue());
}
if (!readOnly) {
//Save the numberpicker value in the DB, and continue to the next screen.
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String positiveIntValue = String.valueOf(numberPicker.getText());
//Required, empty values rejected
if(checkEditTextNotNull(positiveIntValue)){
numberPicker.setError(context.getString(R.string.dynamic_error_age));
return;
}
Question question = progressTabStatus.getCurrentQuestion();
ReadWriteDB.saveValuesText(question, positiveIntValue, module);
hideKeyboard(context,v);
finishOrNext();
}
});
}else{
numberPicker.setEnabled(false);
button.setEnabled(false);
}
//Add button to listener
swipeTouchListener.addClickableView(button);
//Take focus and open keyboard
openKeyboard(numberPicker);
}
示例8: updateStaticPanelData
import android.widget.TableRow; //导入方法依赖的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());
}
}
示例9: setUpPropertiesForFlight
import android.widget.TableRow; //导入方法依赖的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));
}
}