1

I'm trying to make an app with a webview of facebook.com, i want to load custom css but i don't know how. I searched on Google but found old tutorials and i read that it has changed in Android Studio 2.0

Here is my code:

private WebView myWebView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myWebView = (WebView)findViewById(R.id.webView);
        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        myWebView.loadUrl("https://www.facebook.com/");
        myWebView.setWebViewClient(new WebViewClient());
    }
bendaf
  • 2,981
  • 5
  • 27
  • 62
Droid
  • 41
  • 2
  • Check [This](http://stackoverflow.com/questions/7585210/webview-add-local-css-file-to-an-html-page) and Check [This](http://stackoverflow.com/questions/22124770/how-to-apply-custom-css-to-android-webview-when-url-is-from-internet-server) – Devendra Singh Apr 26 '16 at 11:07
  • `Android Studio 2.0` has nothing to do with the Android Development. You can still use eclipse and develop android apps. – Murtaza Khursheed Hussain Apr 26 '16 at 11:37
  • 1
    place your Css file in Assets folder and in webview give path of your css to load.. – Ramesh Kumar Apr 26 '16 at 13:03
  • @RameshKumar i don't have an Assets folder. I'm using android studio 2.0 – Droid Apr 26 '16 at 13:15
  • if don't have the create an assets folder in main folder (src->main->assets) – Ramesh Kumar Apr 26 '16 at 13:21
  • @RameshKumar thanks. i got the assets folder now but how do i give path to my css to load? – Droid Apr 26 '16 at 13:30
  • refer this. http://stackoverflow.com/questions/7585210/webview-add-local-css-file-to-an-html-page?lq=1 – Ramesh Kumar Apr 26 '16 at 14:29
  • @RameshKumar this is what i got now: https://justpaste.it/to68 ... it doesn't work :( I'm trying to load https://www.facebook.com/ with custom css.. i have the style.css stored in my assets folder – Droid Apr 26 '16 at 14:47

0 Answers0