【发布时间】:2012-12-30 05:32:28
【问题描述】:
我正在尝试在片段中实现 CordovaWebView (2.2.0),但在尝试扩展布局时返回错误。
我的 xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<org.apache.cordova.CordovaWebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id = "@+id/mainView"/>
</FrameLayout>
我的 onCreateView:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.cordovawebview, container); // <--- the error occurs here!
return v;
}
错误:
10-25 15:52:02.839: 错误/AndroidRuntime(2878): 致命 例外:主要 android.view.InflateException: Binary XML file line #21: Error inflating class org.apache.cordova.CordovaWebView NullPointerException CordovaWebView.java 第 691 行
int id = getResources().getIdentifier("config", "xml", this.cordova.getActivity().getPackageName());
这里的资源好像是空的。
我已经检查过了,config.xml文件在xml文件夹中。
我可以在 FragmentActivity 中实现它,但我需要在 Fragment 中实现它。
有什么想法吗?
提前致谢。
【问题讨论】:
标签: android android-fragments android-webview cordova-2.0.0