Java Code Examples for android.widget.TableLayout#indexOfChild()
The following examples show how to use
android.widget.TableLayout#indexOfChild() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListItemExtensions.java From Android-WYSIWYG-Editor with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: ManualGames.java From Simple-Solitaire with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(View v) { //get index of the button as seen from the container TableRow row = (TableRow) v.getParent(); TableLayout table = (TableLayout) row.getParent(); int index = table.indexOfChild(row) * COLUMNS + row.indexOfChild(v); loadGameText(index); }
Example 3
Source File: ListItemExtensions.java From Android-WYSIWYG-Editor with Apache License 2.0 | 5 votes |
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); } }
Example 4
Source File: ListItemExtensions.java From Android-WYSIWYG-Editor with Apache License 2.0 | 4 votes |
public int getIndexOnEditorByEditText(CustomEditText customEditText) { TableRow tableRow = (TableRow) customEditText.getParent(); TableLayout tableLayout = (TableLayout) tableRow.getParent(); int indexOnTable = tableLayout.indexOfChild(tableRow); return indexOnTable; }