2012-11-13 27 views
2

我嘗試實施一項活動CordovaWebView,但我得到以下錯誤:如何實現CordovaWebView在活動

android.view.InflateException: Binary XML file line #12: Error inflating class 
org.apache.cordova.CordovaWebView 

這裏是我的代碼:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<!-- TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" /--> 

<org.apache.cordova.CordovaWebView 
    android:id="@+id/tutorialView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" /> 

</LinearLayout> 

和:

public class NewActivity extends Activity implements CordovaInterface { 

CordovaWebView cwv; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    // TODO Auto-generated method stub 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 

    cwv = (CordovaWebView) findViewById(R.id.tutorialView); 
    cwv.loadUrl("file:///android_asset/www/index.html"); 
} 
} 

我的Phonegap版本是2.2.0 任何人都可以告訴它爲什麼會發生?

在此先感謝

KOBI

+0

難道你看喬的例子嗎? https://github.com/infil00p/CordovaActionView –

+0

此外,該堆棧跟蹤應該有一個* lot *多於一行。 – CommonsWare

+0

這是可能得到沒有xml佈局的CordovaWebview。即CordovaWebview webview = new CordovaWebview(this); webview.loadurl(「some url」);上面的鏈接是 – Karthick

回答