2012-12-10 14 views
1

在我的應用程序中,我通過手段android.graphics.Camera 3d轉換。這似乎工作得很好,直到我嘗試Nexus。三維動畫/相機轉換和現代設備

我在Nexus 7(4.2.1)和Galaxy Nexus(4.1.2)上安裝了應用程序,它們都不執行相機轉換。我有兩個不同的相機視圖,都顯示標準動畫,不適用相機轉換。

誰能解釋這種行爲?

UPD: 相機代碼

transformation.clear();  
transformation.setTransformationType(Transformation.TYPE_MATRIX); 
mCamera.save();  
final Matrix matrix = transformation.getMatrix();   
mCamera.translate(x,y,z); 
mCamera.getMatrix(matrix); 
matrix.preTranslate(-centerX, -centerY);   
matrix.postTranslate(centerX, centerY);   
mCamera.restore(); 

UPD2: 銀河S3相同的(4.2),而與S2(4.0.4)

+0

您的轉換代碼在哪裏? –

+0

有人可以在任何Nexus上試用嗎? – Mikhail

回答

0

只需添加到getChildStaticTransformation

的端部
if (android.os.Build.VERSION.SDK_INT >= 16 /*JellyBean*/) child.invalidate(); 
+0

我試圖使用http://code.google.com/p/android-3d-flip-view-transition/ 似乎這是Nexus 7上的類似問題,但您的解決方案無法正常工作。 – Drake29a

0

由Mikhail提供的解決方案在getChildStaticTransformation結束時爲我工作。

唯一的問題是getChildStaticTransformation方法將始終被調用。

我的解決方案是將代碼放在更新後的每個項目的x,y,z值之後。

// items is a ArrayList of ControlItem for example 
// x,y,z are custom property of ControlItem class 

items.get(0).x = 250; 
items.get(0).y = 100; 
items.get(0).z = 0; 

for (ControlItem item : items) 
{ 
    // Item must be invalidate with JellyBean and superior 
    if (android.os.Build.VERSION.SDK_INT >= 16) item.invalidate(); 
} 

// getChildStaticTransformation() will be called after, transformation will be applied