嗨,我有三个片段选项卡视图,三个具有 Web 视图的选项卡正在尝试在我的应用程序中添加网站 .. 我的片段不支持 getApplicationContext() .. 请帮助我在 ma 活动中添加缓存。
import info.androidhive.tabsswipe.R;
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.WebView;
import android.webkit.WebViewClient;
public class ServicesFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_services, container, false);
WebView webView = (WebView)rootView.findViewById(R.id.webView1);
webView.loadUrl("http://www.zudioz.com/services.html");
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setDomStorageEnabled(true);
webView.setWebViewClient(new WebViewClient());
return rootView;
}
}