本文整理汇总了Java中android.widget.TableLayout.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java TableLayout.getChildCount方法的具体用法?Java TableLayout.getChildCount怎么用?Java TableLayout.getChildCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TableLayout
的用法示例。
在下文中一共展示了TableLayout.getChildCount方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
}
示例2: 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);
}
}
示例3: 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));
}
}
}
}
示例4: 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);
}
}
}
示例5: 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;
}
示例6: 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) + ".");
}
}
示例7: 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("•");
}
}
示例8: 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) + ".");
}
}
示例9: 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());
}
}
}
}
示例10: cleanTable
import android.widget.TableLayout; //导入方法依赖的package包/类
private void cleanTable(TableLayout table) {
int childCount = table.getChildCount();
// Remove all rows except the first one
if (childCount > 1) {
table.removeViews(1, childCount - 1);
}
}
示例11: setProperties
import android.widget.TableLayout; //导入方法依赖的package包/类
private void setProperties(ArrayList<FileMeta> properties) {
this.properties = properties;
if (properties == null) {
propertiesCard.setVisibility(View.GONE);
return;
}
if (propertiesCard.getVisibility() != View.VISIBLE) {
propertiesCard.setVisibility(View.VISIBLE);
}
Analytics.EventBuilder analytics = Analytics.newEvent("busybox properties");
for (FileMeta property : properties) {
analytics.put(property.label, property.value);
}
analytics.log();
TableLayout tableLayout = getViewById(R.id.table_properties);
if (tableLayout.getChildCount() > 0) {
tableLayout.removeAllViews();
}
int width = ResUtils.dpToPx(128);
int left = ResUtils.dpToPx(16);
int top = ResUtils.dpToPx(6);
int bottom = ResUtils.dpToPx(6);
int i = 0;
for (FileMeta meta : properties) {
TableRow tableRow = new TableRow(getActivity());
TextView nameText = new TextView(getActivity());
TextView valueText = new TextView(getActivity());
if (i % 2 == 0) {
tableRow.setBackgroundColor(0x0D000000);
} else {
tableRow.setBackgroundColor(Color.TRANSPARENT);
}
nameText.setLayoutParams(new TableRow.LayoutParams(width, ViewGroup.LayoutParams.WRAP_CONTENT));
nameText.setPadding(left, top, 0, bottom);
nameText.setAllCaps(true);
nameText.setTypeface(Typeface.DEFAULT_BOLD);
nameText.setText(meta.name);
valueText.setPadding(left, top, 0, bottom);
valueText.setText(meta.value);
tableRow.addView(nameText);
tableRow.addView(valueText);
tableLayout.addView(tableRow);
i++;
}
}
示例12: 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;
}