boolean isVertical = true|false; //defines which direction the QuiltView will scroll: true = Vertical, false = Horizontal
QuiltView quiltView = new QuiltView(context, isVertical); //(QuiltView) findViewById(R.id.quilt);
Adding Children
Children must be added to the QuiltView programmatically as an ArrayList of ImageViews:
ArrayList<ImageView> images = new ArrayList<ImageView>();
for(int i = 0; i < num; i++){
ImageView image = new ImageView(this.getApplicationContext());
image.setScaleType(ScaleType.CENTER_CROP);
image.setImageResource(R.drawable.bg);
images.add(image);
}
quiltView.addPatchImages(images);
Or an ArrayList of Views
ArrayList<View> views = new ArrayList<View>();
for(int i = 0; i < num; i++){
FrameLayout patch = new FrameLayout(this.getApplicationContext());
views.add(patch);
}
quiltView.addPatchViews(views);
Goals for this view
Have no empty patches
Be sudo-random (lays out the children differently each time)
请发表评论