English 中文(简体)
网上浏览的平稳横向分布
原标题:smooth horizontal scrolling in webview

我有几页(文本的栏目)的绕过,希望能够在各栏之间横向发展,以回应计票。 我可以用滚动(To)来做这一罚款,但这是相当突然的,我确实希望能够从一页顺利过渡到下一页。

The problem as I see it: you can t attach a Scroller to a WebView, and shouldn t nest a WebView in a ScrollView.

是否有任何良好想法在网上通话中实施平稳或不断的横向滚动?

加入: 我试图在我使用未经证实的假肢来计算距离的地方执行一个叫.的想法。

    // vx and vy are from the onfling event of the gesture detector 
    scroller.fling(page*x, 0, vx, vy, page*(x + 1), page*(x + 1), 0, 0);

    while(scroller.computeScrollOffset()){
        webview.scrollTo(scroller.getCurrX(), 0);
        webview.invalidate();
    }

......但是,虽然 lo似乎太慢,无法抓住er者的流动,或者说是这样,因为行为似乎像 s(滚动)方法一样(这种观点 jump到滚动末)。

最佳回答

您不能附在网上浏览器上,但你也可以利用这种姿态。

The gesture detects the fling using this method

onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)

Give the velocityX, velocityY to the scoller method along with other parameters

fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY)

• 寻找CurrX(CurrY())职位,扫描计算值。

Extend the webview and override the methods onTouchEvent(MotionEvent ev), dispatchTouchEvent(MotionEvent ev) to return false so that by default the touch events are not consumed by the webview itself. Now implement the gestureListener and override the onfling method mentioned above. pass the velocity and other parameters to the scroller. Start a loop to scan the computeScrollOffset() value to find the getCurrX() and getCurrY() and invalidate the view each time. Pass this value to scroll the webview as needed.

如果需要的话,请让我知道。

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签