use of android.widget.GridLayout in project android_frameworks_base by crdroidandroid.
the class BitmapDrawableDupe method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ScrollView scrollView = new ScrollView(this);
GridLayout container = new GridLayout(this);
scrollView.addView(container);
container.setColumnCount(5);
container.setBackgroundColor(0xFF888888);
DecimalFormat df = new DecimalFormat("#.##");
long time = android.os.SystemClock.elapsedRealtimeNanos();
for (int i = 0; i < icon.length; i++) {
Button button = new Button(this);
button.setWidth(200);
button.setBackgroundResource(icon[i]);
container.addView(button);
}
setContentView(scrollView);
time = android.os.SystemClock.elapsedRealtimeNanos() - time;
TextView t = new TextView(this);
t.setText("avgS=" + df.format(time / (icon.length * 1000000.)) + " ms");
container.addView(t);
}
use of android.widget.GridLayout in project android_frameworks_base by crdroidandroid.
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 crdroidandroid.
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 ActivityTransition method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK));
setContentView(R.layout.activity_transition);
setupHero();
// Ensure that all images are visible regardless of orientation.
GridLayout gridLayout = (GridLayout) findViewById(R.id.transition_grid_layout);
boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
gridLayout.setRowCount(isPortrait ? 4 : 2);
gridLayout.setColumnCount(isPortrait ? 2 : 4);
}
use of android.widget.GridLayout in project platform_frameworks_base by android.
the class AnimatedStateVectorDrawableTest method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ScrollView scrollView = new ScrollView(this);
GridLayout container = new GridLayout(this);
scrollView.addView(container);
container.setColumnCount(2);
for (int i = 0; i < icon.length; i++) {
CheckBox button = new CheckBox(this);
button.setWidth(400);
button.setHeight(400);
button.setBackgroundResource(icon[i]);
container.addView(button);
}
setContentView(scrollView);
}
Aggregations