本文整理了Java中android.widget.TableRow.getChildCount()
方法的一些代码示例,展示了TableRow.getChildCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableRow.getChildCount()
方法的具体详情如下:
包路径:android.widget.TableRow
类名称:TableRow
方法名:getChildCount
暂无
代码示例来源:origin: stackoverflow.com
//This will iterate through your table layout and get the total amount of cells.
for(int i = 0; i < table.getChildCount(); i++)
{
//Remember that .getChildAt() method returns a View, so you would have to cast a specific control.
TableRow row = (TableRow) table.getChildAt(i);
//This will iterate through the table row.
for(int j = 0; j < row.getChildCount(); j++)
{
Button btn = (Button) row.getChildAt(j);
//Do what you need to do.
}
}
代码示例来源:origin: stackoverflow.com
private void setChildrenOnClickListener(TableRow tr) {
final int c = tr.getChildCount();
for (int i=0; i < c; i++) {
final View v = tr.getChildAt(i);
if (v instanceof RadioButton) {
v.setOnClickListener(this);
if (((RadioButton) v).isChecked())
activeRadioButton = (RadioButton) v;
}
}
}
代码示例来源:origin: stackoverflow.com
for(int i = 0; i < getChildCount(); i++) {
TableRow row = (TableRow) getChildAt(i);
for(int j = 0; j < row.getChildCount(); j++) {
TextView tv = (TextView) row.getChildAt(j);
Log.e("DatasetTableLayout-data", tv.getText().toString() + " ");
}
}
代码示例来源:origin: stackoverflow.com
TableRow tableRow = (TableRow)findViewById(R.id.tableRow1);
int childCount = tableRow.getChildCount();
for (int i = 0; i < childCount; i++){
ImageView backgroundImg = (ImageView) tableRow.getChildAt(i);
backgroundImg.setBackgroundColor(Color.rgb(255, 255, 255));
}
代码示例来源:origin: stackoverflow.com
int count = tablelayout.getChildCount();
for(int i = 0; i < count; i++){
View v = tablelayout.getChildAt(i);
if(v instanceof TableRow){
TableRow row = (TableRow)v;
int rowCount = row.getChildCount();
for (int r = 0; r < rowCount; r++){
View v2 = row.getChildAt(r);
if (v2 instanceof Button){
Button b = (Button)v2;
b.setOnClickListener(new onClickListener ...//add the mehtod yourself please,I always use eclipse's hints,I forgot exactly how the method looks, but it's a method that has a View v as parameter );
}
}
}
代码示例来源:origin: stackoverflow.com
int rowNumCount = table.getChildCount();
for(int count = 1; count < rowNumCount; count++) {
View v = table.getChildAt(count);
if(v instanceof TableRow) {
final TableRow clickRow = (TableRow)v;
int rowCount = clickRow.getChildCount();
v.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Context context = getTabHost().getContext();
TableRow row = (TableRow)v;
TextView tv = (TextView)row.getChildAt(0);
CharSequence text = "Lot VALUE Selected: " + tv.getText();
int duration = Toast.LENGTH_SHORT;
Toast.makeText(context, text, duration).show();
}
});
}
}
代码示例来源:origin: stackoverflow.com
public void onClick(View v) {
if (v instanceof TableRow) {
TableRow row = (TableRow) v;
String msg = "";
for (int i=0; i < row.getChildCount(); i++) {
TextView child = (TextView) row.getChildAt(i);
msg += String.valueOf(child.getId()) + " ";
}
Toast toast = Toast.makeText(this, msg, Toast.LENGTH_SHORT);
toast.show();
}
}
代码示例来源:origin: stackoverflow.com
String sValues="";
for (int i = 0; i < tbl.getChildCount(); i++) {
TableRow row = (TableRow)tbl.getChildAt(i);
for (int j = 0; j < row.getChildCount(); j++) {
if(row.getChildAt(j) instanceof EditText){
EditText editText1 = (EditText)row.getChildAt(j);
sValues += editText1.getText().toString();
}
}
}
代码示例来源:origin: stackoverflow.com
public void populateTable(){
//list of all the data from each row
//each row is stored as an instance of the Entry class
List<Entry> grab_all = populateList();
for (int i = 0; i<(grab_all.size()-1); i++){
addRow();
}
int child_count = t1.getChildCount();
//loops through each row
for (int i=0; i<child_count; i++){
TableRow row = (TableRow)t1.getChildAt(i);
//loops through each column to input data from the table
for (int m=0; m<row.getChildCount();m++){
EditText text = (EditText)row.getChildAt(m);
if (m == 0){//first textfield accepts letters
text.setText((grab_all.get(i).getDESCRIPT()));
}
else if (m==1){
text.setText(String.valueOf(grab_all.get(i).getGRADE()));
}
else
text.setText(String.valueOf(grab_all.get(i).getWEIGHT()));
}
}
}
代码示例来源:origin: alt236/USB-Device-Info---Android
final TableRow row = (TableRow) t.getChildAt(i);
for (int j = 0; j <= row.getChildCount() - 1; j++) {
final View v = row.getChildAt(j);
代码示例来源:origin: stackoverflow.com
TableLayout layout = (TableLayout) findViewById(R.id.IdTable);
for (int i = 0; i < layout.getChildCount(); i++) {
View child = layout.getChildAt(i);
if (child instanceof TableRow) {
TableRow row = (TableRow) child;
for (int x = 0; x < row.getChildCount(); x++) {
View view = row.getChildAt(x);
view.setEnabled(false);
}
}
}
代码示例来源:origin: mkulesh/microMathematics
private CustomEditText getCell(int row, int col)
{
if (row < getChildCount())
{
final TableRow tr = (TableRow) getChildAt(row);
if (tr != null && col < tr.getChildCount())
{
return (CustomEditText) tr.getChildAt(col);
}
}
return null;
}
代码示例来源:origin: stackoverflow.com
TableLayout layout = (TableLayout) findViewById(R.id.Table_ID);
for (int i = 0; i < layout.getChildCount(); i++) {
View child = layout.getChildAt(i);
if (child instanceof TableRow) {
TableRow row = (TableRow) child;
for (int x = 0; x < row.getChildCount(); x++) {
View view = row.getChildAt(x);//Here you get Your Button View
}
}
}
代码示例来源:origin: stackoverflow.com
final int c = tr.getChildCount();
for (int i = 0; i < c; i++) {
final View v = tr.getChildAt(i);
代码示例来源:origin: stackoverflow.com
TableLayout tableLayout = (TableLayout) findViewById(R.id.tableLayout);
View child;
TableRow tableRow;
// As the first line is headings, skip the first row
for (int i = 1; i < tableLayout.getChildCount(); i++) {
child = tableLayout.getChildAt(i);
if (child instanceof TableRow) {
tableRow = (TableRow) child;
// As the first line has labels, skip the first column
for (int j = 1; j < tableRow.getChildCount(); j++) {
child = tableRow.getChildAt(j);
if (child instanceof RadioButton) {
((RadioButton) child).setOnCheckedChangeListener(onCheckedChangeListener);
}
}
}
}
代码示例来源:origin: stackoverflow.com
TableRow tableRow = lv.getItemAtPosition(1);
for (int i = 0; i < tableRow.getChildCount(); i++) {
View child = tableRow.getChildAt(i);
if ( child instanceof TextView ) {
TextView textView = (TextView) child;
textView.DO_SOMETHIG__WITH_TEXT_VIEV();
textView.requestLayout();
}
}
tableRow.requestLayout();
代码示例来源:origin: fire3/sailorcast
@Override
public void onClick(View view) {
TableLayout table = (TableLayout) view.getParent().getParent();
for (int l = 0; l < table.getChildCount(); l++) {
TableRow row = (TableRow) table.getChildAt(l);
for (int i = 0; i < row.getChildCount(); i++) {
((CheckedTextView) (row.getChildAt(i))).setChecked(false);
SCChannelFilterItem item = (SCChannelFilterItem) row.getChildAt(i).getTag(R.id.key_filter_item);
item.setChecked(false);
}
}
((CheckedTextView) view).setChecked(true);
SCChannelFilterItem item = (SCChannelFilterItem) view.getTag(R.id.key_filter_item);
item.setChecked(true);
}
});
代码示例来源:origin: stackoverflow.com
TableLayout layout=(TableLayout) findViewById(R.id.Layout);
for(int i=0;i<layout.getChildCount();i++) {
if (layout.getChildAt(i) instanceof TableRow) {
TableRow tableRow = (TableRow) layout.getChildAt(i);
for(int j=0;j<tableRow.getChildCount();j++) {
if (tableRow.getChildAt(j) instanceof Button) {
Button button = (Button) tableRow.getChildAt(j);
//your button is here
}
}
}
}
代码示例来源:origin: shrikanth7698/Collapsible-Calendar-View-Android
@Override
protected void redraw() {
// redraw all views of week
TableRow rowWeek = (TableRow) mTableHead.getChildAt(0);
if (rowWeek != null) {
for (int i = 0; i < rowWeek.getChildCount(); i++) {
((TextView) rowWeek.getChildAt(i)).setTextColor(getTextColor());
}
}
// redraw all views of day
if (mAdapter != null) {
for (int i = 0; i < mAdapter.getCount(); i++) {
LocalDate day = mAdapter.getItem(i);
View view = mAdapter.getView(i);
TextView txtDay = view.findViewById(R.id.txt_day);
txtDay.setBackgroundColor(Color.TRANSPARENT);
txtDay.setTextColor(getTextColor());
// set today's item
if (isToady(day)) {
txtDay.setBackgroundDrawable(getTodayItemBackgroundDrawable());
txtDay.setTextColor(getTodayItemTextColor());
}
// set the selected item
if (isSelectedDay(day)) {
txtDay.setBackgroundDrawable(getSelectedItemBackgroundDrawable());
txtDay.setTextColor(getSelectedItemTextColor());
}
}
}
}
代码示例来源:origin: stackoverflow.com
if (mHideOnSelect) hide();
TableRow parent = (TableRow) v.getParent();
final int count = parent.getChildCount();
for (int i = 0; i < count; i++) {
final View child = parent.getChild(i);
内容来源于网络,如有侵权,请联系作者删除!