2012-04-26 139 views
0
<base href="http://www.myurl.com/"> 
     <link href="templates/default/css/mycss.css?1" rel="stylesheet" type="text/css" /> 

我想加载一个带有andrid webview的url。该页面已加载,但没有CSS。有一种方法(相对路径)。有没有办法直接加载页面的CSS没有缓存,并打开它与loadDataWithBaseURLWebview,样式表相对路径int url

感谢advamce

回答

0

尝试......

Description = (WebView)findViewById(R.id.webView1); 
    Description.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); 
    Description.getSettings().setJavaScriptEnabled(true); 
    Description.getSettings().setBuiltInZoomControls(true); 
    //PodcastDescription.setTextSize(20.f); 
    //PodcastDescription.setTypeface(tf); 

    Bundle mybundle = getIntent().getExtras(); 
    Integer NewsNumber = mybundle.getInt("number"); 


    String CurrentDescription = Entertainment.Description[NewsNumber]; 




    Description.loadDataWithBaseURL (null, "<html><head><style>@font-face{font-family:'MeeraRegular'; src: url('file:///android_asset/fonts/Meera.ttf');}body{font-family:'MeeraRegular'; font-size:20px; } </style></head><body>"+CurrentDescription+"</body></html>", "text/html", "UTF-8", 
    null); 
+0

我需要缓存整个页面以获得CurrentDescription。我想避免它 – Blackbelt 2012-04-26 10:35:20