2011-04-13 36 views

回答

1

擴展庫,並重寫此方法像這樣:

protected boolean getChildStaticTransformation(View child, Transformation t) { 
    t.clear(); 
    t.setTransformationType(Transformation.TYPE_MATRIX); 
    final Matrix matrix = t.getMatrix(); 
    float childCenterPos = child.getLeft() + (child.getWidth()/2f); 
    float center = getWidth()/2; 
    float diff = Math.abs(center - childCenterPos); 
    float scale = diff/getWidth(); 

    matrix.setScale(1 - (scale), 1 - (scale)); 

    return true; 
} 

很明顯,你可以做更多的interresting東西與矩陣相比,只是縮放,但這只是一個例子,它可以輕鬆完成。