Search in sources :

Example 11 with Spec

use of android.widget.GridLayout.Spec in project android_frameworks_base by ResurrectionRemix.

the class GridLayoutTest method create.

public ViewGroup create(Context context) {
    GridLayout container = new GridLayout(context);
    container.setOrientation(VERTICAL);
    for (int i = 0; i < VERTICAL_ALIGNMENTS.length; i++) {
        int va = VERTICAL_ALIGNMENTS[i];
        for (int j = 0; j < HORIZONTAL_ALIGNMENTS.length; j++) {
            int ha = HORIZONTAL_ALIGNMENTS[j];
            Spec rowSpec = spec(UNDEFINED, null);
            Spec colSpec = spec(UNDEFINED, null);
            GridLayout.LayoutParams lp = new GridLayout.LayoutParams(rowSpec, colSpec);
            //GridLayout.LayoutParams lp = new GridLayout.LayoutParams();
            lp.setGravity(va | ha);
            View v = create(context, VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j], 20);
            container.addView(v, lp);
        }
    }
    return container;
}
Also used : GridLayout(android.widget.GridLayout) Spec(android.widget.GridLayout.Spec) View(android.view.View)

Example 12 with Spec

use of android.widget.GridLayout.Spec in project android_frameworks_base by crdroidandroid.

the class GridLayoutTest method create.

public ViewGroup create(Context context) {
    GridLayout container = new GridLayout(context);
    container.setOrientation(VERTICAL);
    for (int i = 0; i < VERTICAL_ALIGNMENTS.length; i++) {
        int va = VERTICAL_ALIGNMENTS[i];
        for (int j = 0; j < HORIZONTAL_ALIGNMENTS.length; j++) {
            int ha = HORIZONTAL_ALIGNMENTS[j];
            Spec rowSpec = spec(UNDEFINED, null);
            Spec colSpec = spec(UNDEFINED, null);
            GridLayout.LayoutParams lp = new GridLayout.LayoutParams(rowSpec, colSpec);
            //GridLayout.LayoutParams lp = new GridLayout.LayoutParams();
            lp.setGravity(va | ha);
            View v = create(context, VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j], 20);
            container.addView(v, lp);
        }
    }
    return container;
}
Also used : GridLayout(android.widget.GridLayout) Spec(android.widget.GridLayout.Spec) View(android.view.View)

Aggregations

GridLayout (android.widget.GridLayout)12 Spec (android.widget.GridLayout.Spec)12 Button (android.widget.Button)8 EditText (android.widget.EditText)8 Space (android.widget.Space)8 TextView (android.widget.TextView)8 View (android.view.View)4