2016-07-07 92 views
0

我想向用戶展示3D封閉的滾動紙張,他們可以用手指展開什麼。什麼是最好的方式來做到這一點?Android - 如何做一個可觸摸的滾動紙張動畫?

+0

有沒有一個例子可以鏈接來說明這一點?你有沒有看過什麼呢? –

+0

類似這樣的:https://www.youtube.com/watch?v=JWy_ZD4pJMk – Peter

回答

1

要達到像你想要的的影響,你需要第一件事是平面設計師

你需要兩個特別的圖形資源:

  1. 完整的圖像沒有底部滾動部分的鋪開羊皮紙
  2. 羊皮紙的底部 - 爲此,您將需要多個框架(以使滾動成爲動畫)。所以你需要每幀滾動動畫1張圖片。

一旦你有了這些資產,你需要正確地佈置它們。

我會推薦這樣的佈局(僞佈局):

<LinearLayout - vertical, this will be your main container> 
    <RelativeLayout - will start at a small height, and will grow with animation. Should crop children> 
     <ImageView - with the top & center part of the parchment 
        - give this view an explicit height which is equal to the fully 
        extended size of the parent layout/> 
     <... any additional layouts or views /> 
    </RelativeLayout> 
    <ImageView - contains a single frame of the rolling bottom part 
       - replace the image with the next frame every few milliseconds/> 
</LinearLayout> 

概念上講,這應該足以獲得你想要的效果。

道歉的答案的抽象性,但由於你沒有發佈任何你試過的代碼(我假設你還沒有嘗試過),對我來說沒有太多跟...共事。

希望這會給你足夠的想法讓你開始。

+0

謝謝,我會檢查出來。是的,我還沒有做任何事情,因爲我不知道如何開始。感謝您的幫助,謝謝。 – Peter

+0

有沒有任何教程會有幫助? – Peter

+0

這將很難找到一個涵蓋這個特定需求的教程。這完全是關於如何瞭解你擁有的工具,以及如何使用它們來獲得你需要的地方。 –