Home >Web Front-end >HTML Tutorial >android studio创建assets目录并且利用webView加载其html_html/css_WEB-ITnose

android studio创建assets目录并且利用webView加载其html_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:17:201764browse

1、在Android Studio中添加assets目录,首先调整成project模式

在main的目录下新建一文件夹叫:assets 。  WebView\src\main\assets


在项目的WebView.iml中加入:   



2、在利用webView加载html文件


<span style="white-space:pre">	</span>@Override	protected void onCreate(Bundle savedInstanceState) {		super.onCreate(savedInstanceState);		setContentView(R.layout.activity_main);		webView = (WebView) findViewById(R.id.webView);		webView.loadUrl("file:///android_asset/web.html");	}



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn