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

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

WBOY
Release: 2016-06-24 11:17:20
Original
1731 people have browsed it

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");	}
Copy after login



source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template