問題描述
我一直在尋找一種合適的方法來模擬 iOS 應用中使用的翻頁/卷曲類型,但在 Android 應用中.我在 Android 上看到的最接近的東西是 Google Play Books 應用程序.他們是否使用了我沒見過的 SDK 的某些部分?有沒有機會得到類似的實現?
I've been searching for a proper way to emulate the kind of page flipping/curling used in the iOS apps but in an Android app. The closest thing I have seen on Android is the Google Play Books app. Are they using some part of the SDK that I haven't seen? Is there any chance of getting my hands on a similar implementation?
我見過的大多數示例都是使用某種基于 OpenGL 的 RenderView 構建的.這可能會奏效,但我必須確保屏幕不會徒勞無功,因為我不想使用太多電量.在處理不是 pow2 的紋理時,我也有點害怕使用 OpenGL.
Most of the examples I have seen are built using some sort of RenderView based on OpenGL. That would probably work, but I would have to make sure that the screen is not rendered in vain, since I don't want to use too much power. Also I'm a little afraid of using OpenGL when handling textures that are not pow2.
最好的問候,卡樂
推薦答案
你必須使用OpenGL才能在Android中制作這樣的效果并且必須使用下面常見的正弦圖方程:-
You have to use OpenGl for making such effect in Android and have to use the below common sinusoidal graph equation :-
y=Asin(2π/λ*x)
y=Asin(2π/λ*x)
在哪里,
A = 幅度(即我們想要的卷曲高度).
A = Amplitude (i.e. the elevation of curl we want).
λ = 波長(即我們想要的卷曲長度).
λ = Wavelength (i.e. the length of the curl we want).
x = X 軸變量,當您移動頁面時會發生變化.
x = The X axis variable which will change as you move the page.
你必須在 SurfaceView 上繪制 3 個頁面,即 'LeftPage' 、 'CenterPage' 和 'RightPage' , 'CenterPage' 始終可見并負責 'right curl' 動畫,而 'LeftPage' 負責 'left curl'動畫和RightPage"只是保持靜止.檢測手勢使用默認的 GestureDetector 類.
You have to draw 3 pages on SurfaceView namely 'LeftPage' , 'CenterPage' and 'RightPage', 'CenterPage' is always visible and is responsible for 'right curl' animation while 'LeftPage' is responsible for 'left curl' animation and 'RightPage' just stay static. For detecting gestures use default GestureDetector class.
您可以從這里下載示例.
這篇關于如何實現 Google Play 圖書中使用的頁面卷曲類型?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!