警报对话框中的WebView

问题描述 投票:0回答:1

我正在应用程序中使用WebView视图在“警报”对话框中呈现gif文件,它说未找到网页,但我确定该文件位于资产文件夹中

主要活动:

AlertDialog.Builder builder = new AlertDialog.Builder(EasyGame.this);
                    WebView v = new WebView(EasyGame.this);
                    v.setLayoutParams(new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT));
                    builder.setView(v);
                    builder.create().show();
                    v.loadUrl("file:///assets/animations/cloud.gif");

gifwebview.java:

public class GIFWebView extends WebView {

    public GIFWebView(Context context, String path) {
        super(context);
        loadUrl(path);
        // TODO Auto-generated constructor stub
    }


}
android webview gif
1个回答
0
投票

更改

© www.soinside.com 2019 - 2024. All rights reserved.