本文整理匯總了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;
}
};
}
示例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);
}
}
}
}
示例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);
}
}
示例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;
}
示例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));
}
}
}
}
示例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);
}
}
}
示例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;
}
示例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) + ".");
}
}
示例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("•");
}
}
示例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) + ".");
}
}
示例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);
}
}
示例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());
}
}
}
}
示例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;
}