android.widget.TableRow.getChildAt()方法的使用及代码示例

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

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

TableRow.getChildAt介绍

暂无

代码示例

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

for(int i=0;i<3;i++)
{
 TableRow row = (TableRow)tblLayout.getChildAt(i);
 for(int j=0;j<3;j++){
  Button button = (Button)row.getChildAt(j); // get child index on particular row
  String buttonText = button.getText().toString();
  Log.i("Button index: "+(i+j), buttonText);
 }
}

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

TableLayout tblLayout = (TableLayout)findViewById(R.id.tableLayout);
TableRow row = (TableRow)tblLayout.getChildAt(0); // Here get row id depending on number of row
Button button = (Button)row.getChildAt(XXX); // get child index on particular row
String buttonText = button.getText().toString();

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

table.post(new Runnable() {
   @Override
   public void run() {
     TableRow tableRow = (TableRow)table.getChildAt(0);
     for(int i = 0; i < headerRow.getChildCount(); i++){
       headerRow.getChildAt(i).setLayoutParams(new TableRow.LayoutParams(tableRow.getChildAt(i).getMeasuredWidth(), tableRow.getChildAt(i).getMeasuredHeight()));
     }
   }
 });

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

//...
tr.setOnClickListener(new View.OnClickListener() {
  public void onClick(View view) {
   TableRow t = (TableRow) view;
   TextView firstTextView = (TextView) t.getChildAt(0);
   TextView secondTextView = (TextView) t.getChildAt(1);
   String firstText = firstTextView.getText().toString();
   String secondText = secondTextView.getText().toString();
  }
});
//...

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

public void onClick(View v){

  TableRow row= (TableRow) findViewById(v.getId());

  imageContainer=(<imageContainertype>) row.getChildAt(1);

  ImageView imageB =(ImageView) imageContainer.getChildAt(1);

  imageContainer.removeView(imageB);
}

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

tv.setOnClickListener(new OnClickListener()
         {
           public void onClick(View voew) 
           {
              TableRow t = (TableRow) voew; //Your Layout
              TextView firstTextView = (TextView) t.getChildAt(0);
              String firstText = firstTextView.getText().toString();
            }
         });

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

TableLayout tbL = (TableLayout) findViewById(R.id.tbL);
TableRow row1=(TableRow)tbL.getChildAt(0);
SeekBar sb1=(SeekBar) row1.getChildAt(0);
TextView txt1_1=(TextView) row1.getChildAt(1);
TextView txt1_2=(TextView) row1.getChildAt(2);
..etc

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

tableRow.setClickable(true);  //allows you to select a specific row

tableRow.setOnClickListener(new OnClickListener() {
   public void onClick(View view) {
    TableRow tablerow = (TableRow) view; 
    TextView sample = (TextView) tablerow.getChildAt(1);
    String result=sample.getText().toString();

    Toast toast = Toast.makeText(myActivity, result, Toast.LENGTH_LONG);
    toast.show();
  }
});

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

protected void initCheckBox(final int i, TableRow checkBoxes, Set<Integer> nbCounts) {
  final CheckBox checkBox = (CheckBox) checkBoxes.getChildAt(i);
  checkBox.setChecked(rule != null && nbCounts.contains(i));
  setOnClickListener(checkBox);
}

代码示例来源:origin: zsoltk/GameOfLife

void setCheckboxStates() {
  Set<Integer> creationNbCounts = fragment.rule.getCreationNbCounts();
  Set<Integer> survivalNbCounts = fragment.rule.getSurvivalNbCounts();
  for (int i = 0; i < 9; i++) {
    CheckBox creation = (CheckBox) fragment.creationCheckBoxes.getChildAt(i);
    CheckBox survival = (CheckBox) fragment.survivalCheckBoxes.getChildAt(i);
    creation.setChecked(creationNbCounts.contains(i));
    survival.setChecked(survivalNbCounts.contains(i));
  }
}

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

String myText;
((TextView) findViewById(R.id.tv)).setOnClickListener(new OnClickListener() {
 @Override
 public void onClick(View v) {                          
  TableRow tablerow = (TableRow)v.getParent();
  TextView items = (TextView) tablerow.getChildAt(2);

  myText = items.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

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 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: 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 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

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();

相关文章