Xamarin实验室的混合Web视图在某些特定android设备中不调用回调
我有一个来自实验室的混合web视图,它调用JS并显示返回。。。它是在模拟器和其他设备,如三星Galaxy S5工作。。。 但在我的Galaxy S2和索尼Xperia上,它不起作用。。。。删除了一些不重要的代码 我的班级:Xamarin实验室的混合Web视图在某些特定android设备中不调用回调,android,xamarin,android-webview,xamarin.forms.labs,Android,Xamarin,Android Webview,Xamarin.forms.labs,我有一个来自实验室的混合web视图,它调用JS并显示返回。。。它是在模拟器和其他设备,如三星Galaxy S5工作。。。 但在我的Galaxy S2和索尼Xperia上,它不起作用。。。。删除了一些不重要的代码 我的班级: public class TestPage : ContentPage { HtmlWebViewSource hwvsource = new HtmlWebViewSource(); HybridWebView hwv = new HybridWeb
public class TestPage : ContentPage
{
HtmlWebViewSource hwvsource = new HtmlWebViewSource();
HybridWebView hwv = new HybridWebView() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand };
StackLayout stack = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand };
public TestPage ()
{
this.hwv.RegisterCallback ("dataCallback", JSCallback);
//script that receives a list and call Native('dataCallback', list); ....
this.hwvsource.Html = @"
<!DOCTYPE html>
<html>
<head>
<script language=""javascript"">
Native('dataCallback', list);
</script>
</head>
</html>";
this.hwv.Source = hwvsource;
stack.Children.Add(activityIndicator);
stack.Children.Add(hwv);
stack.Children.Add(listView);
this.Content = stack;
this.hwv.LoadFinished += (object sender, EventArgs e) =>
{
this.hwv.IsVisible = false;
};
}
private void JSCallback(string result){
DisplayAlert ("callback", result, "ok");
}
}
我是怎么说的,它在其他设备上运行良好,但S2除外
你知道会是什么吗?你在S2上有什么Android版本?我刚刚发现是什么导致了这个问题。。。在javascript中,我传递了纬度和经度。我的s2的格式是xx,xxxx,其他设备的格式是xx.xxxx。。。。只是逗号和点之间的区别。。。我刚刚替换为Latitude.ToString().Replace(“,”,“。”),它成功了!!Tks!
[Trace] error opening trace file: No such file or directory (2)
[monodroid] Trying to load sgen from: /data/app-lib/app.Droid-1/libmonosgen-2.0.so
[monodroid-gc] GREF GC Threshold: 46080
[libEGL] loaded /system/lib/egl/libEGL_mali.so
[libEGL] loaded /system/lib/egl/libGLESv1_CM_mali.so
[libEGL] loaded /system/lib/egl/libGLESv2_mali.so
[] Device driver API match
[] Device driver API version: 17
[] User space API version: 17
[] mali: REVISION=Linux-r3p1-01rel1 BUILD_DATE=Tue Jul 2 15:06:24 KST 2013
[OpenGLRenderer] Enabling debug mode 0
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[IInputConnectionWrapper] clearMetaKeyStates on inactive InputConnection
[IInputConnectionWrapper] getExtractedText on inactive InputConnection
[IInputConnectionWrapper] getTextBeforeCursor on inactive InputConnection
[IInputConnectionWrapper] getSelectedText on inactive InputConnection
[IInputConnectionWrapper] getTextAfterCursor on inactive InputConnection
[libc] protoent* getprotobyname(char const*)(3) is not implemented on Android
[libc] protoent* getprotobyname(char const*)(3) is not implemented on Android
[libc] protoent* getprotobyname(char const*)(3) is not implemented on Android
[Choreographer] Skipped 32 frames! The application may be doing too much work on its main thread.
[dalvikvm-heap] Grow heap (frag case) to 11.443MB for 5760016-byte allocation
Location ViewModel Messaging
*****Here*****
[TilesManager] Starting TG #0, 0x528e53f8
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[PicturePileLayerContent] Warning: painting PicturePile without content!
[webcore] skip viewSizeChanged as w is 0