嗨我有三个片段标签视图,三个标签有网页视图我试图在我的应用程序中添加网站..我不支持getApplicationContext()片段.. plz帮我在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;
}
}
答案 0 :(得分:0)
使用getActivity()。getApplicationContext()。