我为 webview 设置了 SurfaceView,如下所示:
wv.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
@Override
public void onChildViewRemoved(View parent, View child) {}
@Override
public void onChildViewAdded(View parent, View child) {
if(child.getClass().getName().equals("com.adobe.flashplayer.FlashPaintSurface")){
Log.i("flash", "surface is open");
((SurfaceView)child).setZOrderOnTop(false);
((SurfaceView)child).dispatchWindowFocusChanged(isHidden());
}}
});
但...
当我单击 WebViewText 时,尝试在那里写一些我的应用程序崩溃,并显示该错误日志:
03-07 10:14:37.425: E/AndroidRuntime(7378): FATAL EXCEPTION: main
03-07 10:14:37.425: E/AndroidRuntime(7378): java.lang.ClassCastException: android.webkit.WebTextView cannot be cast to android.view.SurfaceView
我是个白痴——忘了把括号放在 if(){} 中。请不要降低我的价格!