小编Moh*_*iaz的帖子

Webview里面的弹出窗口android

在此处输入图片说明

嗨,我有一个问题,如上图所示,左侧有一个 web 视图内的按钮。当我单击按钮时,应该会出现 android 中的弹出窗口。在那个弹出窗口中,我需要一个 webview。现在,在弹出窗口中没有 webview 的情况下,它一切正常。

这个弹出窗口是由javascript接口调用的

public class AppJavaScriptProxy {

    private Activity activity = null;

    public AppJavaScriptProxy() {

    }

    @JavascriptInterface
    public String showMessage(String footNoteNo) {
        Integer footNoteNoInt = Integer.parseInt(footNoteNo);
        footnote = myDbHelper.getFootnote(chapterNumber, footNoteNoInt);

        try {

            LayoutInflater inflater = (LayoutInflater) HomeActivity.this
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View layout = inflater.inflate(R.layout.footnote_popup,
                    (ViewGroup) findViewById(R.id.popup_footnote));
            popup = new PopupWindow(layout, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, true);
            popup.showAtLocation(layout, Gravity.CENTER, 0, 0);
            txt_footnote=(TextView) layout.findViewById(R.id.text_footnote);
            txt_footnote.setTypeface(malayalamfont);
            popup_close = (ImageButton) layout.findViewById(R.id.btn_close_popup);
            txt_footnote.setText(footnote);

            final WebView footnoteWView = (WebView) layout.findViewById(R.id.footnotePopupWebview);
            footnoteWView.getSettings().setJavaScriptEnabled(true);
           footnoteWView.loadUrl("file:///android_asset/www/footNotePopup.html");
            footnoteWView.clearCache(true);

           footnoteWView.setWebViewClient(new WebViewClient(){ …
Run Code Online (Sandbox Code Playgroud)

javascript java android popupwindow webview

0
推荐指数
1
解决办法
3585
查看次数

标签 统计

android ×1

java ×1

javascript ×1

popupwindow ×1

webview ×1