我有 2 个主要症结来编译以下简单的 WebView 示例:
铸件
(WebView)findViewById(R$id::webview)
给unresolved JvmIdentifiableElement
匿名类部分完全不起作用。我想Xtend不支持它?
这是源代码:
package com.stackoverflow
import android.app.Activity
import android.webkit.WebView
import android.os.Bundle
import android.webkit.WebViewClient
class HelloWebViewActivity extends Activity
{
WebView _webView
override void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState)
setContentView(R$layout::main)
// Error "Couldn't resolve reference to JvmIdentifiableElement 'WebView'"
_webView = (WebView)findViewById(R$id::webview)
_webView.settings.javaScriptEnabled = true
_webView.loadUrl("http://stackoverflow.com")
// A bunch of complaints towards the anonymous class
_webView.setWebViewClient(new WebViewClient()
{
override shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url)
true
}
})
}
}
我的.classpath
:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins" />
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="con" path="org.eclipse.xtend.XTEND_CONTAINER"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
想法?