当前位置: 首页>>代码示例>>Java>>正文


Java TableRow.getChildAt方法代码示例

本文整理汇总了Java中android.widget.TableRow.getChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java TableRow.getChildAt方法的具体用法?Java TableRow.getChildAt怎么用?Java TableRow.getChildAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TableRow的用法示例。


在下文中一共展示了TableRow.getChildAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeBoard

import android.widget.TableRow; //导入方法依赖的package包/类
protected void initializeBoard() {
    size = 3;
    board = new int[size][size];
    mainBoard = findViewById(R.id.mainBoard);
    tv_turn = findViewById(R.id.turn);

    if (myTurn) {
        tv_turn.setText(String.format(getString(R.string.your_turn),
                String.valueOf(myTurnChar)));
    } else {
        tv_turn.setText(String.format(getString(R.string.their_turn),
                rival.getNick(), String.valueOf(flipChar(myTurnChar))));
    }

    resetBoard(null);

    for (int i = 0; i < mainBoard.getChildCount(); i++) {
        TableRow row = (TableRow) mainBoard.getChildAt(i);
        for (int j = 0; j < row.getChildCount(); j++) {
            TextView tv = (TextView) row.getChildAt(j);
            tv.setOnClickListener(MoveListener(i, j, tv));
            tv.setTextColor(ContextCompat.getColor(getBaseContext(), R.color.black));
        }
    }
}
 
开发者ID:bridgefy,项目名称:bridgefy-android-samples,代码行数:26,代码来源:TicTacToeActivity.java

示例2: resetBoard

import android.widget.TableRow; //导入方法依赖的package包/类
protected void resetBoard(int[][] board) {
    for (int i = 0; i < size; i++) {
        TableRow row = (TableRow) mainBoard.getChildAt(i);
        for (int j = 0; j < size; j++) {
            char c = board != null ? (char) board[i][j] : 0;
            this.board[i][j] = c;

            TextView tv = (TextView) row.getChildAt(j);
            switch (c) {
                case 'X':
                    tv.setText(R.string.X);
                    break;
                case 'O':
                    tv.setText(R.string.O);
                    break;
                default:
                    tv.setText(R.string.none);
                    break;
            }
        }
    }
}
 
开发者ID:bridgefy,项目名称:bridgefy-android-samples,代码行数:23,代码来源:TicTacToeActivity.java

示例3: withTableLayout

import android.widget.TableRow; //导入方法依赖的package包/类
public static Matcher<View> withTableLayout(final int tableLayoutId, final int row, final int column) {
  return new CustomTypeSafeMatcher<View>(format("Table layout with id: {0} at row: {1} and column: {2}",
    tableLayoutId, row, column)) {
    @Override
    protected boolean matchesSafely(View item) {
      View view = item.getRootView().findViewById(tableLayoutId);

      if (view == null || !(view instanceof TableLayout))
        return false;
      TableLayout tableLayout = (TableLayout) view;
      TableRow tableRow = (TableRow) tableLayout.getChildAt(row);
      View childView = tableRow.getChildAt(column);
      return childView == item;
    }
  };
}
 
开发者ID:jainsahab,项目名称:AndroidSnooper,代码行数:17,代码来源:EspressoViewMatchers.java

示例4: updateLayoutHolder

import android.widget.TableRow; //导入方法依赖的package包/类
public void updateLayoutHolder(View vToBeAdded, boolean bRemoveAllFirst)	{
	if (bRemoveAllFirst)	{
		mlLayoutholderInputPadCfg.removeAllViews();
	}
	mlLayoutholderInputPadCfg.addView(vToBeAdded);
	vToBeAdded.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
	if (vToBeAdded instanceof TableLayout)	{
		int nNumofRows = ((TableLayout)vToBeAdded).getChildCount();
		for (int idx = 0; idx < nNumofRows; idx ++)	{
			TableRow tr = (TableRow)((TableLayout)vToBeAdded).getChildAt(idx);
			tr.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
			int nNumofBtns = tr.getChildCount();
			for (int idx1 = 0; idx1 < nNumofBtns; idx1 ++)	{
				View vBtn = tr.getChildAt(idx1);
				// height has been set before.
				vBtn.setLayoutParams(new TableRow.LayoutParams(0, vBtn.getLayoutParams().height, 1));
			}
		}
	}
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:21,代码来源:ActivityCfgKeyPad.java

示例5: altTableRow

import android.widget.TableRow; //导入方法依赖的package包/类
public void altTableRow(int alt_row) {
    int childViewCount = tablelayout.getChildCount();

    for (int i = 0; i < childViewCount; i++) {
        TableRow row = (TableRow) tablelayout.getChildAt(i);

        for (int j = 0; j < row.getChildCount(); j++) {

            TextView tv = (TextView) row.getChildAt(j);
            if (i % alt_row != 0) {
                tv.setBackground(getResources().getDrawable(
                        R.drawable.alt_row_color));
            } else {
                tv.setBackground(getResources().getDrawable(
                        R.drawable.row_color));
            }
        }
    }
}
 
开发者ID:bertrandmartel,项目名称:rfdroid-scanparam,代码行数:20,代码来源:BtDevicesActivity.java

示例6: altTableRow

import android.widget.TableRow; //导入方法依赖的package包/类
/**
 * alternate colors for description rows
 *
 * @param alt_row
 */
public void altTableRow(int alt_row) {
    int childViewCount = tablelayout.getChildCount();

    for (int i = 0; i < childViewCount; i++) {
        TableRow row = (TableRow) tablelayout.getChildAt(i);

        for (int j = 0; j < row.getChildCount(); j++) {

            TextView tv = (TextView) row.getChildAt(j);
            if (i % alt_row != 0) {
                tv.setBackground(getResources().getDrawable(
                        R.drawable.alt_row_color));
            } else {
                tv.setBackground(getResources().getDrawable(
                        R.drawable.row_color));
            }
        }
    }
}
 
开发者ID:bertrandmartel,项目名称:bluetooth-le-analyzer,代码行数:25,代码来源:AnalyzerActivity.java

示例7: altTableRow

import android.widget.TableRow; //导入方法依赖的package包/类
/**
 * alternate between 2 colors for the description item table
 *
 * @param alt_row
 */
public void altTableRow(int alt_row) {
    int childViewCount = tablelayout.getChildCount();

    for (int i = 0; i < childViewCount; i++) {
        TableRow row = (TableRow) tablelayout.getChildAt(i);

        for (int j = 0; j < row.getChildCount(); j++) {

            TextView tv = (TextView) row.getChildAt(j);
            if (i % alt_row != 0) {
                tv.setBackground(getResources().getDrawable(
                        R.drawable.alt_row_color));
            } else {
                tv.setBackground(getResources().getDrawable(
                        R.drawable.row_color));
            }
        }
    }
}
 
开发者ID:bertrandmartel,项目名称:hci-debugger,代码行数:25,代码来源:DescriptionActivity.java

示例8: altTableRow

import android.widget.TableRow; //导入方法依赖的package包/类
/**
 * alternate colors for description rows
 *
 * @param alt_row
 */
public void altTableRow(int alt_row, TableLayout tablelayout) {

    int childViewCount = tablelayout.getChildCount();

    for (int i = 0; i < childViewCount; i++) {
        TableRow row = (TableRow) tablelayout.getChildAt(i);

        for (int j = 0; j < row.getChildCount(); j++) {

            TextView tv = (TextView) row.getChildAt(j);
            if (i % alt_row != 0) {
                tv.setBackground(getResources().getDrawable(
                        R.drawable.alt_row_color));
            } else {
                tv.setBackground(getResources().getDrawable(
                        R.drawable.row_color));
            }
        }
    }
}
 
开发者ID:bertrandmartel,项目名称:bluetooth-remote-control,代码行数:26,代码来源:DeviceActivity.java

示例9: disableInputs

import android.widget.TableRow; //导入方法依赖的package包/类
protected void disableInputs() {
    // disable play inputs
    for (int i = 0; i < mainBoard.getChildCount(); i++) {
        TableRow row = (TableRow) mainBoard.getChildAt(i);
        for (int j = 0; j < row.getChildCount(); j++) {
            TextView tv = (TextView) row.getChildAt(j);
            tv.setOnClickListener(null);
            tv.setTextColor(ContextCompat.getColor(getBaseContext(), R.color.gray));
        }
    }
}
 
开发者ID:bridgefy,项目名称:bridgefy-android-samples,代码行数:12,代码来源:TicTacToeActivity.java

示例10: nextView

import android.widget.TableRow; //导入方法依赖的package包/类
View nextView(View currentView) {
    boolean foundCurrentView = false;
    for(int row = 0; row < rows; row++) {
        TableRow tr = (TableRow) getChildAt(row);
        for(int column = 0; column < columns; column++) {
            if(foundCurrentView) return tr.getChildAt(column);
            else if(currentView == tr.getChildAt(column)) foundCurrentView = true;
        }
    }
    return parent.getChildAt(parent.getChildIndex(this) + 1);
}
 
开发者ID:gigabytedevelopers,项目名称:CalcMate,代码行数:12,代码来源:MatrixView.java

示例11: load

import android.widget.TableRow; //导入方法依赖的package包/类
public static boolean load(final MutableString text, final AdvancedDisplay parent, final int pos) {
    if(!MatrixView.verify(text)) return false;

    String matrix = MatrixView.parseMatrix(text.getText());
    text.setText(text.substring(matrix.length()));
    int rows = MatrixView.countOccurrences(matrix, '[') - 1;
    int columns = MatrixView.countOccurrences(matrix, ',') / rows + 1;

    MatrixView mv = new MatrixView(parent);
    for(int i = 0; i < rows; i++) {
        mv.addRow();
    }
    for(int i = 0; i < columns; i++) {
        mv.addColumn();
    }
    String[] data = matrix.split(",|\\]\\[");
    for(int order = 0, row = 0; row < rows; row++) {
        TableRow tr = (TableRow) mv.getChildAt(row);
        for(int column = 0; column < columns; column++) {
            EditText input = (EditText) tr.getChildAt(column);
            input.setText(data[order].replaceAll("[\\[\\]]", ""));
            order++;
        }
    }
    AdvancedDisplay.LayoutParams params = new AdvancedDisplay.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER_VERTICAL;
    mv.setLayoutParams(params);
    parent.addView(mv, pos);

    return true;
}
 
开发者ID:gigabytedevelopers,项目名称:CalcMate,代码行数:32,代码来源:MatrixView.java

示例12: setClearingLayoutSizes

import android.widget.TableRow; //导入方法依赖的package包/类
public void setClearingLayoutSizes(View rootView, Context context) {

        DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
        float dpHeight = displayMetrics.heightPixels / displayMetrics.density;
        float dpWidth = displayMetrics.widthPixels / displayMetrics.density;

        dpHeight -= addClearingButton.getHeight();

        dpHeight /= 9;
        dpWidth /= 7;


        int finalValue = (int) Math.min(dpHeight, dpWidth);

        TableLayout table = rootView.findViewById(R.id.clearingGrid);
        final int childcount = table.getChildCount();
        for (int i = 0; i < childcount; i++) {
            TableRow row = (TableRow) table.getChildAt(i);

            final int cellCount = row.getChildCount();
            for (int j = 0; j < cellCount; j++) {
                TextView cell = (TextView) row.getChildAt(j);
                cell.setHeight(finalValue);
                cell.setWidth(finalValue);
            }


        }
    }
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:30,代码来源:SSAdventureMapFragment.java

示例13: getCell

import android.widget.TableRow; //导入方法依赖的package包/类
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;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:13,代码来源:ResultMatrixLayout.java

示例14: setHighscoreText

import android.widget.TableRow; //导入方法依赖的package包/类
private void setHighscoreText(Highscore highscore) {
       for (int i = 0; i < highscore.getNumEntries(); i++) {
       	TableRow row = (TableRow)mHighscoreTable.getChildAt(i+1);
       	TextView tvName = (TextView)row.getChildAt(1);
       	tvName.setText(highscore.getEntry(i).name);
       	TextView tvLevel = (TextView)row.getChildAt(2);
       	tvLevel.setText(Integer.toString(highscore.getEntry(i).level));
       	TextView tvScore = (TextView)row.getChildAt(3);
       	tvScore.setText(Integer.toString(highscore.getEntry(i).score));
	}
}
 
开发者ID:zipzapdat,项目名称:AndroFish,代码行数:12,代码来源:AndroFishHighscoreActivity.java

示例15: setChildrenOnClickListener

import android.widget.TableRow; //导入方法依赖的package包/类
/**
 *
 * @param tr -
 */
private void setChildrenOnClickListener( TableRow tr ){
    final int c = tr.getChildCount();
    for ( int i = 0; i < c; i++ ){
        View v = tr.getChildAt(i);
        if ( v instanceof RadioButton ) v.setOnClickListener(this);
    }
}
 
开发者ID:pylapp,项目名称:SmoothClicker,代码行数:12,代码来源:RadioButtonGroupTableLayout.java


注:本文中的android.widget.TableRow.getChildAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。