I want to load CSS and JS files localy from android assets folder for better perfomance in android webview,Is it possible? I appreciate your help,thanks
            Asked
            
        
        
            Active
            
        
            Viewed 5,292 times
        
    1 Answers
3
            In android project
WebView myweb = FindViewById<WebView>(Resource.Id.webView1);
myweb.LoadUrl("file:///android_asset/index.html");
In index.html
<link href="style.css" rel="stylesheet" type="text/css">
<script src="script.js"></script> 
And if you need to increase android webview performance and graphic change this properties
myweb.Settings.JavaScriptEnabled = true;
myweb.Settings.DisplayZoomControls = false;
myweb.Settings.SetRenderPriority(WebSettings.RenderPriority.High);
if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
{
   myweb.SetLayerType(Android.Views.LayerType.Hardware, null);
}
if you are using android studio : view this link
if you need only js or css files view this Answers:
 
    
    
        Mohamed Sa'ed
        
- 781
- 4
- 13
- 
                    thx for your answer,but I only want to load CSS and JS not the entire website. – amir nazarifar Jan 22 '18 at 10:12
- 
                    i didn't get you , you need to load js and css to A page already exists in webview – Mohamed Sa'ed Jan 22 '18 at 10:23
