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


Java TableLayout.getChildAt方法代码示例

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


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

示例1: withTableLayout

import android.widget.TableLayout; //导入方法依赖的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

示例2: paintBar

import android.widget.TableLayout; //导入方法依赖的package包/类
private void paintBar(TableLayout table, Integer time) {
    for(int i = 0 ; i < table.getChildCount(); i++) {
        View view = table.getChildAt(i);
        if (view instanceof TableRow) {

            TableRow row = (TableRow) view;
            View cell = ((TableRow) view).getChildAt(0);


            if(i<time){
                if(((double)time/(double)table.getChildCount())<0.85d){
                    cell.setBackgroundColor(Color.parseColor("#4fa5d5"));
                }else{
                    cell.setBackgroundColor(Color.parseColor("#ed1c00"));
                }
            }else{
                cell.setBackgroundColor(0x00000000);
            }
        }
    }
}
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:22,代码来源:STRIDERAdventureTimeOxygenFragment.java

示例3: ConvertListToNormalText

import android.widget.TableLayout; //导入方法依赖的package包/类
public void ConvertListToNormalText(TableLayout _table, int startIndex) {
    int tableChildCount = _table.getChildCount();
    for (int i = startIndex; i < tableChildCount; i++) {
        View _childRow = _table.getChildAt(i);
        _table.removeView(_childRow);
        String text = getTextFromListItem(_childRow);
        int Index = editorCore.getParentView().indexOfChild(_table);
        editorCore.getInputExtensions().insertEditText(Index + 1, "", text);
        i -= 1;
        tableChildCount -= 1;
    }
    //if item is the last in the table, remove the table from parent

    if (_table.getChildCount() == 0) {
        editorCore.getParentView().removeView(_table);
    }
}
 
开发者ID:irshuLx,项目名称:Android-WYSIWYG-Editor,代码行数:18,代码来源:ListItemExtensions.java

示例4: setFocusToSpecific

import android.widget.TableLayout; //导入方法依赖的package包/类
public CustomEditText setFocusToSpecific(CustomEditText customEditText) {
    TableRow tableRow = (TableRow) customEditText.getParent();
    TableLayout tableLayout = (TableLayout) tableRow.getParent();
    int indexOnTable = tableLayout.indexOfChild(tableRow);
    if (indexOnTable == 0) {
        //what if index is 0, get the previous on edittext
    }
    TableRow prevRow = (TableRow) tableLayout.getChildAt(indexOnTable - 1);
    if (prevRow != null) {
        CustomEditText editText = (CustomEditText) tableRow.findViewById(R.id.txtText);
        if (editText.requestFocus()) {
            editText.setSelection(editText.getText().length());
        }
        return editText;
    }
    return null;
}
 
开发者ID:irshuLx,项目名称:Android-WYSIWYG-Editor,代码行数:18,代码来源:ListItemExtensions.java

示例5: altTableRow

import android.widget.TableLayout; //导入方法依赖的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

示例6: setClearingLayoutSizes

import android.widget.TableLayout; //导入方法依赖的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

示例7: getRows

import android.widget.TableLayout; //导入方法依赖的package包/类
private static List<TableRow> getRows (TableLayout table) {
    List<TableRow> list = new ArrayList<>(table.getChildCount());
    for(int i = 0, j = table.getChildCount(); i < j; i++) {
        View view = table.getChildAt(i);
        if (view instanceof TableRow) {
            TableRow row = (TableRow) view;
            list.add(row);
        }
    }
    return list;
}
 
开发者ID:Trumeet,项目名称:Animations,代码行数:12,代码来源:AppearAnimationActivity.java

示例8: convertListToOrdered

import android.widget.TableLayout; //导入方法依赖的package包/类
public void convertListToOrdered(TableLayout _table) {
    EditorControl type = editorCore.createTag(EditorType.ol);
    _table.setTag(type);
    for (int i = 0; i < _table.getChildCount(); i++) {
        View _childRow = _table.getChildAt(i);
        CustomEditText editText = (CustomEditText) _childRow.findViewById(R.id.txtText);
        editText.setTag(editorCore.createTag(EditorType.OL_LI));
        _childRow.setTag(editorCore.createTag(EditorType.OL_LI));
        TextView _bullet = (TextView) _childRow.findViewById(R.id.lblOrder);
        _bullet.setText(String.valueOf(i + 1) + ".");
    }
}
 
开发者ID:irshuLx,项目名称:Android-WYSIWYG-Editor,代码行数:13,代码来源:ListItemExtensions.java

示例9: convertListToUnordered

import android.widget.TableLayout; //导入方法依赖的package包/类
public void convertListToUnordered(TableLayout _table) {
    EditorControl type = editorCore.createTag(EditorType.ul);
    _table.setTag(type);
    for (int i = 0; i < _table.getChildCount(); i++) {
        View _childRow = _table.getChildAt(i);
        CustomEditText _EditText = (CustomEditText) _childRow.findViewById(R.id.txtText);
        _EditText.setTag(editorCore.createTag(EditorType.UL_LI));
        _childRow.setTag(editorCore.createTag(EditorType.UL_LI));
        TextView _bullet = (TextView) _childRow.findViewById(R.id.lblOrder);
        _bullet.setText("•");
    }
}
 
开发者ID:irshuLx,项目名称:Android-WYSIWYG-Editor,代码行数:13,代码来源:ListItemExtensions.java

示例10: rearrangeColumns

import android.widget.TableLayout; //导入方法依赖的package包/类
private void rearrangeColumns(TableLayout _table) {
    //TODO, make sure that if OL, all the items are ordered numerically
    for (int i = 0; i < _table.getChildCount(); i++) {
        TableRow tableRow = (TableRow) _table.getChildAt(i);
        TextView _bullet = (TextView) tableRow.findViewById(R.id.lblOrder);
        _bullet.setText(String.valueOf(i + 1) + ".");
    }
}
 
开发者ID:irshuLx,项目名称:Android-WYSIWYG-Editor,代码行数:9,代码来源:ListItemExtensions.java

示例11: validateAndRemoveLisNode

import android.widget.TableLayout; //导入方法依赖的package包/类
public void validateAndRemoveLisNode(View view, EditorControl contentType) {
    /*
     *
     * If the person was on an active ul|li, move him to the previous node
     *
     */
    TableRow _row = (TableRow) view.getParent();
    TableLayout _table = (TableLayout) _row.getParent();
    int indexOnList = _table.indexOfChild(_row);
    _table.removeView(_row);
    if (indexOnList > 0) {
        /**
         * check if the index of the deleted row is <0, if so, move the focus to the previous li
         */
        TableRow focusrow = (TableRow) _table.getChildAt(indexOnList - 1);
        EditText text = (EditText) focusrow.findViewById(R.id.txtText);
        /**
         * Rearrange the nodes
         */
        if (contentType.Type == EditorType.OL_LI) {
            rearrangeColumns(_table);
        }
        if (text.requestFocus()) {
            text.setSelection(text.getText().length());
        }
    } else {
        /**
         * The removed row was first on the list. delete the list, and set the focus to previous element on the editor
         */
        editorCore.removeParent(_table);
    }
}
 
开发者ID:irshuLx,项目名称:Android-WYSIWYG-Editor,代码行数:33,代码来源:ListItemExtensions.java

示例12: setFocusToList

import android.widget.TableLayout; //导入方法依赖的package包/类
public void setFocusToList(View view, int position) {
    TableLayout tableLayout = (TableLayout) view;
    int count = tableLayout.getChildCount();
    if (tableLayout.getChildCount() > 0) {
        TableRow tableRow = (TableRow) tableLayout.getChildAt(position == POSITION_START ? 0 : count - 1);
        if (tableRow != null) {
            EditText editText = (EditText) tableRow.findViewById(R.id.txtText);
            if (editText.requestFocus()) {
                editText.setSelection(editText.getText().length());
            }
        }
    }
}
 
开发者ID:irshuLx,项目名称:Android-WYSIWYG-Editor,代码行数:14,代码来源:ListItemExtensions.java

示例13: checkInput

import android.widget.TableLayout; //导入方法依赖的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


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