我需要这段代码的帮助:
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class InicioFragment extends Fragment {
private WebView mWebView;
public InicioFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
inflater.inflate(R.layout.fragment_inicio, container, false);
View rootView = inflater.inflate(R.layout.fragment_inicio, container);
mWebView = (WebView) rootView.findViewById(R.id.activity_main_webview);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("http://myip/webapp/home.html");
mWebView.setWebViewClient(new WebViewClient());
}
}
所以..应用程序工作,但WebView不..只是白色的屏幕,我知道我的主机好,因为我在其他应用程序中使用Web视图,我得到这样的错误:
glUtilsParamSize: unknow param 0x00000bd0
glUtilsParamSize: unknow param 0x00000b44
任何提示?谢谢!!
答案 0 :(得分:0)
好的我修好了,谢谢:我会把代码留在这里:
package com.icetea09.demomaterialdesigndrawermenu;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.util.Timer;
import java.util.TimerTask;
public class InicioFragment extends Fragment {
private WebView mWebView;
public InicioFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
/* OLD CODE
View rootView = inflater.inflate(R.layout.fragment_inicio, container);
mWebView = (WebView) rootView.findViewById(R.id.activity_main_webview);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("http://myip/webapp/home.html");
mWebView.setWebViewClient(new WebViewClient());
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_inicio, container, false);
*/
/* NEW CODE */
View rootView = inflater.inflate(R.layout.fragment_inicio, container, false);
mWebView = (WebView) rootView.findViewById(R.id.activity_main_webview);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.getSettings().setAppCacheEnabled(false);
mWebView.loadUrl("http://myip/webapp/home.html");
mWebView.setWebViewClient(new WebViewClient());
return rootView;
}
}

谢谢大家:D