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


Java TableRow.getChildCount方法代码示例

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


在下文中一共展示了TableRow.getChildCount方法的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: 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

示例3: 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

示例4: 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

示例5: columnAtPoint

import android.widget.TableRow; //导入方法依赖的package包/类
public int columnAtPoint(Point point) {
	if(tableView == null){
		return -1;
	}
	int[] winLoc = new int[2];
	int[] viewLoc = new int[2];
	tableView.getLocationInWindow(winLoc);
	TableRow tableRow = (TableRow)tableView.getChildAt(0);
	int columnNum = tableRow.getChildCount();
	for (int i = 1; i < columnNum; i++) {
		tableRow.getVirtualChildAt(i).getLocationInWindow(viewLoc);
		int shiftX = viewLoc[0] - winLoc[0];
		if(i == 1){
			if(point.x < shiftX){
				return -1;
			}
		}
		if(point.x < shiftX){
			return i - 1;
		}
	}
	return columnNum - 1;
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:24,代码来源:JTable.java

示例6: 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

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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: arrangeButtons

import android.widget.TableRow; //导入方法依赖的package包/类
private void arrangeButtons() {
    // iterates over each button and puts it in the right place
    for (int i = 0, len = mRadioButtons.size(); i < len; i++) {
        RadioButton radioButtonToPlace = mRadioButtons.get(i);
        int rowToInsert = (mMaxInRow != 0) ? i / mMaxInRow : 0;
        int columnToInsert = (mMaxInRow != 0) ? i % mMaxInRow : i;
        // gets the row to insert. if there is no row create one
        TableRow tableRowToInsert = (mTableLayout.getChildCount() <= rowToInsert)
                ? addTableRow() : (TableRow) mTableLayout.getChildAt(rowToInsert);
        int tableRowChildCount = tableRowToInsert.getChildCount();

        // if there is already a button in the position
        if (tableRowChildCount > columnToInsert) {
            RadioButton currentButton = (RadioButton) tableRowToInsert.getChildAt(columnToInsert);

            // insert the button just if the current button is different
            if (currentButton != radioButtonToPlace) {
                // removes the current button
                removeButtonFromParent(currentButton, tableRowToInsert);
                // removes the button to place from its current position
                removeButtonFromParent(radioButtonToPlace, (ViewGroup) radioButtonToPlace.getParent());
                // adds the button to the right place
                tableRowToInsert.addView(radioButtonToPlace, columnToInsert);
            }

            // if there isn't already a button in the position
        } else {
            // removes the button to place from its current position
            removeButtonFromParent(radioButtonToPlace, (ViewGroup) radioButtonToPlace.getParent());
            // adds the button to the right place
            tableRowToInsert.addView(radioButtonToPlace, columnToInsert);
        }
    }

    removeRedundancies();
}
 
开发者ID:Gavras,项目名称:MultiLineRadioGroup,代码行数:37,代码来源:MultiLineRadioGroup.java

示例13: resize

import android.widget.TableRow; //导入方法依赖的package包/类
public void resize(int rows, int cols, int cellLayoutId)
{
    if (rowsNumber == rows && colsNumber == cols)
    {
        return;
    }
    rowsNumber = rows;
    colsNumber = cols;

    removeAllViews();
    fields.clear();

    final TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams(
            TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);

    final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);

    for (int row = 0; row < rowsNumber; row++)
    {
        final TableRow tableRow = new TableRow(getContext());
        tableRow.setLayoutParams(tableParams); // TableLayout is the parent view
        addView(tableRow);

        for (int col = 0; col < colsNumber; col++)
        {
            inflater.inflate(cellLayoutId, tableRow);
        }

        if (tableRow.getChildCount() > 0)
        {
            tableRow.setBaselineAligned(true);
            tableRow.setBaselineAlignedChildIndex(0);
        }

        for (int col = 0; col < tableRow.getChildCount(); col++)
        {
            final CustomEditText c = (CustomEditText) tableRow.getChildAt(col);
            if (c != null)
            {
                c.setId(IdGenerator.generateId());
                c.setTag(new ElementTag(row, col, fields.size()));
                fields.add(c);
            }
        }
    }

    setPadding(0, 0, 0, 0);
    setBaselineAligned(true);
    setBaselineAlignedChildIndex(rowsNumber > 1 ? rowsNumber / 2 : 0);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:52,代码来源:ResultMatrixLayout.java

示例14: checkInput

import android.widget.TableRow; //导入方法依赖的package包/类
private ArrayList<String> checkInput(View table) {
    if (!(table instanceof TableLayout)) return null;
    ArrayList<String> result = new ArrayList<>();
    TableLayout tableLayout = (TableLayout) table;
    final int childCount = tableLayout.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View tableChild = tableLayout.getChildAt(i);
        if (tableChild instanceof TableRow) {
            TableRow tableRow = (TableRow) tableChild;
            final int count = tableRow.getChildCount();
            for (int j = 0; j < count; j++) {
                View childView = tableRow.getChildAt(j);
                if (!(childView instanceof EditText)) continue;
                EditText editText = (EditText) childView;
                String type = editText.getHint().toString();
                String method = (String) editText.getTag();
                String input = editText.getText().toString().trim();
                if (TextUtils.isEmpty(input)) continue;
                String[] methods = input.split("\n");
                for (String m : methods) {
                    String methodType = "";
                    String[] args = m.split(",");
                    if (type.equals(PARENT_TYPE)) {
                        if (args.length == 1) {
                            methodType = ITEM_OPERATE_TYPE;
                        } else if (args.length == 2) {
                            methodType = ITEM_RANGE_OPERATE_TYPE;
                        }
                    } else if (type.equals(CHILD_TYPE)) {
                        if (args.length == 2) {
                            methodType = ITEM_OPERATE_TYPE;
                        } else if (args.length == 3) {
                            methodType = ITEM_RANGE_OPERATE_TYPE;
                        }
                    } else if (type.equals(MOVE_PARENT_TYPE)) {
                        if (args.length == 2) {
                            methodType = ITEM_OPERATE_TYPE;
                        }
                    } else if (type.equals(MOVE_CHILD_TYPE)) {
                        if (args.length == 4) {
                            methodType = ITEM_OPERATE_TYPE;
                        }
                    }
                    String methodName = String.format(method, methodType);
                    String ma = String.format(getString(R.string.methodAndArgs), methodName, m);
                    result.add(ma);
                }
            }
        }
    }
    Logger.e(TAG, "requestList=" + result.toString());
    return result;
}
 
开发者ID:huajianjiang,项目名称:ExpandableRecyclerView,代码行数:54,代码来源:MyDialog.java

示例15: removeRedundancies

import android.widget.TableRow; //导入方法依赖的package包/类
private void removeRedundancies() {
    // the number of rows to fit the buttons
    int rows;
    if (mRadioButtons.size() == 0)
        rows = 0;
    else if (mMaxInRow == 0)
        rows = 1;
    else
        rows = (mRadioButtons.size() - 1) / mMaxInRow + 1;

    int tableChildCount = mTableLayout.getChildCount();
    // if there are redundant rows remove them
    if (tableChildCount > rows)
        mTableLayout.removeViews(rows, tableChildCount - rows);

    tableChildCount = mTableLayout.getChildCount();
    int maxInRow = (mMaxInRow != 0) ? mMaxInRow : mRadioButtons.size();

    // iterates over the rows
    for (int i = 0; i < tableChildCount; i++) {
        TableRow tableRow = (TableRow) mTableLayout.getChildAt(i);
        int tableRowChildCount = tableRow.getChildCount();

        int startIndexToRemove;
        int count;

        // if it is the last row removes all redundancies after the last button in the list
        if (i == tableChildCount - 1) {
            startIndexToRemove = (mRadioButtons.size() - 1) % maxInRow + 1;
            count = tableRowChildCount - startIndexToRemove;

            // if it is not the last row removes all the buttons after maxInRow position
        } else {
            startIndexToRemove = maxInRow;
            count = tableRowChildCount - maxInRow;
        }

        if (count > 0)
            tableRow.removeViews(startIndexToRemove, count);
    }
}
 
开发者ID:Gavras,项目名称:MultiLineRadioGroup,代码行数:42,代码来源:MultiLineRadioGroup.java


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