android-flip中的Webview无法正常工作

时间:2013-03-26 04:22:06

标签: android android-webview

我使用此lib来使用带有webview的翻转视图:https://github.com/openaphid/android-flip

这是我在适配器中的代码:

public View getView(int position, View convertView, ViewGroup parent) {
            WebView mWeb = null;
            if (convertView == null) {
                mWeb = new WebView(parent.getContext());
                String mCustomHtml = "<h1>Test 0</h1></br>";
                for (int i = 1; i < 20; i++) {
                    mCustomHtml += "<h1>Test " + String.valueOf(i)
                            + "</h1></br>";
                }
                mWeb.loadData(mCustomHtml, "text/html; charset=UTF-8", null);
            } else {
                mWeb = (WebView) convertView;
                mWeb.scrollTo(0, position * 200);
            }
            return mWeb;
        }

但它没有正常工作,前三次翻转,webview仍然在0位置滚动,视图有时会闪烁!

有什么想法吗?谢谢!

0 个答案:

没有答案