我希望在我的应用程序上显示类似桌面版网站的Facebook我尝试使用" facebook.getSettings()。setUserAgentString(" Android");"但它对我没有用。 请帮助!!
public class FaceBookFragment extends Fragment {
WebView facebook;
public FaceBookFragment() {
}
@SuppressLint({ "SetJavaScriptEnabled", "JavascriptInterface" })
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.webview, container, false);
WebView facebook = (WebView) rootView.findViewById(R.id.webview);
facebook.setWebViewClient(new MyWebViewClient());
WebSettings webSettings = facebook.getSettings();
webSettings.setJavaScriptEnabled(true);
facebook.loadUrl("https://www.facebook.com/login/");
return rootView;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}