use of android.widget.GridLayout in project android_frameworks_base by ParanoidAndroid.
the class Activity1 method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new GridLayout(getBaseContext()));
}
use of android.widget.GridLayout in project android_frameworks_base by ParanoidAndroid.
the class AlignmentTest method animate.
public static void animate(View v) {
long start = System.currentTimeMillis();
int N = 1000;
for (int i = 0; i < N; i++) {
ViewGroup.LayoutParams lp = v.getLayoutParams();
// width;
lp.width += 1;
// height;
lp.height += 1;
v.requestLayout();
GridLayout p = (GridLayout) v.getParent();
p.layout(0, 0, 1000 + (i % 2), 500 + (i % 2));
}
float time = (float) (System.currentTimeMillis() - start) / N * 1000;
System.out.println("Time: " + time + "mics");
}
use of android.widget.GridLayout in project android_frameworks_base by ParanoidAndroid.
the class LayoutInsetsTest method create.
public static View create(Context context) {
final int N = GRAVITIES.length;
GridLayout p = new GridLayout(context);
p.setUseDefaultMargins(true);
//p.setAlignmentMode(ALIGN_BOUNDS);
p.setLayoutMode(LAYOUT_MODE_OPTICAL_BOUNDS);
p.setColumnCount(N);
for (int i = 0; i < 2 * N; i++) {
View c;
if (i % 2 == 0) {
TextView tv = new TextView(context);
tv.setTextSize(32);
tv.setText("A");
c = tv;
} else {
Button b = new Button(context);
b.setBackgroundResource(R.drawable.btn_default_normal);
b.setText("B");
c = b;
}
LayoutParams lp = new LayoutParams();
lp.setGravity(GRAVITIES[(i % N)]);
p.addView(c, lp);
}
return p;
}
use of android.widget.GridLayout in project platform_frameworks_base by android.
the class Activity1 method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new GridLayout(getBaseContext()));
}
use of android.widget.GridLayout in project platform_frameworks_base by android.
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;
}
Aggregations