操作栏一键点击进入网址(Webview)

时间:2014-12-29 11:32:33

标签: c# android xamarin

我完成了本教程的应用程序:

link

在这里,我创建了Web视图,每个按钮刷新一页。不幸的是,这是一个问题,因为你必须推送到TWICE页面刷新。如何正确处理第一次点击?

MainActivity.cs:

LinearLayout linTest = (LinearLayout)ActionBar.CustomView.FindViewById<LinearLayout>(Resource.Id.linearLayout1);
            LinearLayout linTest2 = (LinearLayout)ActionBar.CustomView.FindViewById<LinearLayout>(Resource.Id.linearLayout2);
            LinearLayout linTest3 = (LinearLayout)ActionBar.CustomView.FindViewById<LinearLayout>(Resource.Id.linearLayout3);
            LinearLayout linTest4 = (LinearLayout)ActionBar.CustomView.FindViewById<LinearLayout>(Resource.Id.linearLayout4);

            linTest.Click += linTest_Click;
            linTest2.Click += linTest2_Click;
            linTest3.Click += linTest3_Click;
            linTest4.Click += linTest4_Click;


        }

        void linTest_Click(object sender, EventArgs e) {    
            //ur code here
            web_view.LoadUrl ("http://www.onet.pl");
        }

        void linTest2_Click(object sender, EventArgs e) {    
            //ur code here
            web_view.LoadUrl ("http://www.wp.pl");
        }

        void linTest3_Click(object sender, EventArgs e) {    
            //ur code here
            web_view.LoadUrl ("http://www.interia.pl");
        }

        void linTest4_Click(object sender, EventArgs e) {    
            //ur code here
            web_view.LoadUrl ("http://www.google.pl");
        }

log(两次点击):

[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[SpannableStringBuilder] SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
[WebView] loadUrlImpl: called
[webcore]  CORE loadUrl: called
[webkit] Firewall not null
[webkit] euler: isUrlBlocked = false
[WebView] loadUrlImpl: called
[WebCore] uiOverrideUrlLoading: shouldOverrideUrlLoading() returnstrue
[GATE] <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
[webcore]  CORE loadUrl: called
[webkit] Firewall not null
[webkit] euler: isUrlBlocked = false
[GATE] <GATE-M>DEV_ACTION_COMPLETED</GATE-M>

我的问题(屏幕): link

0 个答案:

没有答案