我正在尝试在Android中使用HTML5在webView中播放mp4视频,但遗憾的是它无法正常工作,所以任何人都可以帮助我,我该怎么做?
这是我的代码 HTML文件,名称为new2.html
<video width="365" height="200" src="/sdcard/Download/video.mp4" controls autobuffer></video>
<!--<!DOCTYPE html>
<html>
<body>
<video width="320" height="240" controls autoplay>
<source src="/sdcard/Download/video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>-->
Run Code Online (Sandbox Code Playgroud)
Java文件是:
public class WebActivity extends Activity {
WebView wv;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.web_activity);
wv = (WebView) findViewById(R.id.webview);
wv.loadUrl("file:///android_asset/new2.html");
wv.getSettings().setAllowFileAccess(true);
wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setPluginsEnabled(true);
// webview.loadUrl("file:///android_asset/new.html");
}
}
Run Code Online (Sandbox Code Playgroud)
XML文件是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" …Run Code Online (Sandbox Code Playgroud) 我只是想知道我们能否setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom)在 textview上获得两个不同的 onclick 事件。首先在 textview 上单击,然后在 drawable 上进行其他单击,或者我可以在仅可绘制而不是 textview 上单击。?? 任何帮助将不胜感激。谢谢你。