Merge "Adjust layouts of transition demos to improve fade-outs."
This commit is contained in:
@@ -64,9 +64,11 @@ public class FixedGridLayout extends ViewGroup {
|
||||
final View child = getChildAt(index);
|
||||
child.measure(cellWidthSpec, cellHeightSpec);
|
||||
}
|
||||
// Use the size our parents gave us
|
||||
setMeasuredDimension(resolveSize(mCellWidth*count, widthMeasureSpec),
|
||||
resolveSize(mCellHeight*count, heightMeasureSpec));
|
||||
// Use the size our parents gave us, but default to a minimum size to avoid
|
||||
// clipping transitioning children
|
||||
int minCount = count > 3 ? count : 3;
|
||||
setMeasuredDimension(resolveSize(mCellWidth * minCount, widthMeasureSpec),
|
||||
resolveSize(mCellHeight * minCount, heightMeasureSpec));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,6 +58,7 @@ public class LayoutAnimations extends Activity {
|
||||
setContentView(R.layout.layout_animations);
|
||||
|
||||
container = new FixedGridLayout(this);
|
||||
container.setClipChildren(false);
|
||||
((FixedGridLayout)container).setCellHeight(50);
|
||||
((FixedGridLayout)container).setCellWidth(200);
|
||||
final LayoutTransition transitioner = new LayoutTransition();
|
||||
@@ -77,6 +78,7 @@ public class LayoutAnimations extends Activity {
|
||||
|
||||
ViewGroup parent = (ViewGroup) findViewById(R.id.parent);
|
||||
parent.addView(container);
|
||||
parent.setClipChildren(false);
|
||||
Button addButton = (Button) findViewById(R.id.addNewButton);
|
||||
addButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
||||
@@ -53,10 +53,9 @@ public class LayoutAnimationsHideShow extends Activity {
|
||||
|
||||
final CheckBox hideGoneCB = (CheckBox) findViewById(R.id.hideGoneCB);
|
||||
|
||||
container = new FixedGridLayout(this);
|
||||
((FixedGridLayout)container).setCellHeight(50);
|
||||
((FixedGridLayout)container).setCellWidth(100);
|
||||
container = new LinearLayout(this);
|
||||
container.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
|
||||
// Add a slew of buttons to the container. We won't add any more buttons at runtime, but
|
||||
// will just show/hide the buttons we've already created
|
||||
|
||||
Reference in New Issue
Block a user