0
嗨,我 有一個問題如上圖中,左邊有一個網頁視圖內的按鈕。當我點擊按鈕時,應該會出現android中的popup窗口。在那個彈出窗口中,我需要一個webview。 現在它的所有工作正常,沒有在彈出窗口中的web視圖。
這個彈出窗口是由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(){
public void onPageFinished(WebView view, String url){ footnoteWView.loadUrl("javascript:getFootnote('" + footnote + "')");
}
});
popup_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popup.dismiss();
}
});
}
catch (Exception e) {
e.printStackTrace();
};
}
}
請幫助
請提供更多的細節,以你的問題是什麼。 – Necreaux