android.widget.TableLayout.getChildCount()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中android.widget.TableLayout.getChildCount()方法的一些代码示例,展示了TableLayout.getChildCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableLayout.getChildCount()方法的具体详情如下:
包路径:android.widget.TableLayout
类名称:TableLayout
方法名:getChildCount

TableLayout.getChildCount介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

//Resize elements in the table
TableLayout layout = (TableLayout) findViewById(R.id.TLayout);
for (int i = 0; i < layout.getChildCount(); i++) {
...

代码示例来源:origin: stackoverflow.com

private void cleanTable(TableLayout table) {

  int childCount = table.getChildCount();

  // Remove all rows except the first one
  if (childCount > 1) {
    table.removeViews(1, childCount - 1);
  }
}

代码示例来源:origin: stackoverflow.com

TableLayout table = (TableLayout) findViewById(R.id.give_it_an_id);
TextView courtText;

// For each row
for (int i = 0; i < table.getChildCount(); i++) {
  // Get the one `courtText` in this row
  courtText = table.getChildAt(i).findViewById(R.id.courtText);
  if (courtText != null) {
    // Do something to `courtText`
  }
}

代码示例来源:origin: stackoverflow.com

private void deleteRows(){
   TableLayout tablaPos = (TableLayout) findViewById(R.id.tabla_pos);
   for(int i = 0; i < tablaPos.getChildCount(); i++){ 
     tablaPos.removeViewAt(i); 
   } 
 }

代码示例来源:origin: stackoverflow.com

TableLayout tableLayout = null;
for(int n = 0, s = tableLayout.getChildCount(); n < s; ++n) {
  TableRow row = (TableRow)tableLayout.getChildAt(n);
  TextView name = (TextView)row.findViewById(R.id.tv_name);
}

代码示例来源:origin: stackoverflow.com

TableLayout x = (TableLayout) findViewById(R.id.table_id);
for(int i=0;i<x.getChildCount();i++){
  TableRow tr = (TableRow) x.getChildAt(index);
  //Do here with table row, what u want to do.
}

代码示例来源:origin: stackoverflow.com

int index = 0;
TableLayout tableLayout = findViewById(R.id.table_layout);

for(int n = 0, s = tableLayout.getChildCount(); n < s; ++n) {
  double debt = debtList.get(index);
  double fee = feeList.get(index);

  TableRow row = (TableRow) tableLayout.getChildAt(n);
  TextView cell = (TextView) row.findViewById(R.id.textview_cell);

  name.setText("debt = " + debt + ", fee = " + fee);
  index++;
}

代码示例来源:origin: stackoverflow.com

TableLayout tableView = (TableLayout)findViewById(R.id.mydetails_tableview);
View mytempView=null;
    int noOfChilds=tableView.getChildCount();
    for(int i=0;i<noOfChilds;i++)
    {
      mytempView=tableView.getChildAt(i);
      if(i%2==0)
      {
        View vv=((TableRow) mytempView).getChildAt(1);
        if(vv instanceof EditText)
        {
          //Log.v("This one is edit text---", "here there");
          ((EditText) vv).setText("");
        }
      }
    }

代码示例来源:origin: stackoverflow.com

final TableLayout tview = (TableLayout) findViewById(R.id.tblGridStructure);
      final JSONArray JarraymenuItems = {item1,it3m1mwer,wer,ds};//your list of items
      for (int i = 0; i < JarraymenuItems.length(); i++) 
            {
  ableRow tr = new TableRow(this);
    tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
              tview.addView(tr, LayoutParams.FILL_PARENT, 45);
      T
      final TextView etprice = new TextView(this);
      etprice.setText("your text value wat u want to display");
tr.addView(etprice );
int count = tview.getChildCount();
          if (count % 2 != 0)
          tr.setBackgroundColor(Color.parseColor("#E3E3E3"));
      }

代码示例来源:origin: shrikanth7698/Collapsible-Calendar-View-Android

public void nextWeek() {
  if (mCurrentWeekIndex + 1 >= mTableBody.getChildCount()) {
    mCurrentWeekIndex = 0;
    nextMonth();
  } else {
    mCurrentWeekIndex++;
    collapseTo(mCurrentWeekIndex);
  }
}

代码示例来源:origin: stackoverflow.com

....
onClick(View v) {
 final TableLayout rel=(TableLayout)findViewById(R.id.tab1);
 for(int x=0; x<rel.getChildCount(); x++)
 {
   View v = rel.getChildAt(x);
   rel.removeView(v);
 }
 ....
}

代码示例来源:origin: stackoverflow.com

TableLayout table = (TableLayout) findViewById(R.id.tblScores);
 for(int i = 0; i < table.getChildCount(); i = 0)
 {
   View child = table.getChildAt(0);
   if (child != null && child instanceof TableRow)
   {
     TableRow row = (TableRow) child;
     row.removeAllViews();
     table.removeViewAt(i);
   }        
 }

代码示例来源:origin: stackoverflow.com

for (int i = 1000 + miTlCnt; i > 1000; i--)
{ 
  TableLayout tl = (TableLayout)findViewById(i);
  if (tl != null)
  {
    for (int j = 0; j < tl.getChildCount(); j++)
    {
      TableRow row = (TableRow)tl.getChildAt(j);
      CheckBox chkCompleted = (CheckBox)row.getChildAt(1);
    }
  }
}

代码示例来源: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: stackoverflow.com

TableLayout tl;

tl=(TableLayout)findViewById(R.id.layout);

for(int i=0;i<tl.getChildCount();i++){
  View v=tl.getChildAt(i);
if(v instanceof TableRow){

  for(int j=0;j<v.getChildCount();j++){
   View innerView=v.getChildAt(j);
   if(innerView instanceof ImageView){
    imageList.add((ImageView)innerView);
    idList.add(innerView.getId());
    }
  } 
 }

}

代码示例来源: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

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

TableLayout table = (TableLayout)findViewById(R.id.scrollable_part);
   int sourceColumnIndex = 0;
   int targetColumnIndex = 1;
   for (int i = 0; i < table.getChildCount(); i++)
   {
     TableRow tr = (TableRow)table.getChildAt(i);
     View v = tr.getChildAt(sourceColumnIndex);
     tr.removeViewAt(sourceColumnIndex);
     tr.addView(v, targetColumnIndex);
   }

代码示例来源: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: 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);
  }
});

相关文章