Code example for TableRow

Methods: addView

0
     * Appends a swatch to the end of the row for even-numbered rows (starting with row 0), 
     * to the beginning of a row for odd-numbered rows. 
     */ 
    private void addSwatchToRow(TableRow row, View swatch, int rowNumber) {
        if (rowNumber % 2 == 0) {
            row.addView(swatch);
        } else { 
            row.addView(swatch, 0);
        } 
    } 
 
    /** 
     * Add a content description to the specified swatch view. Because the colors get added in a 
     * snaking form, every other row will need to compensate for the fact that the colors are added 
     * in an opposite direction from their left->right/top->bottom order, which is how the system 
     * will arrange them for accessibility purposes. 
     */ 
    private void setSwatchDescription(int rowNumber, int index, int rowElements, boolean selected,
            View swatch) {
        int accessibilityIndex;
        if (rowNumber % 2 == 0) {