我有一个 PopupWindow,它在按下按钮时显示一个 WebView。如果 setBuiltInZoomControls 设置为false,则 WebView 按预期显示页面。但是,如果 setBuiltInZoomControls 设置为true,则与 WebView(滚动、捏合缩放)的任何交互都会导致错误。
这是Java代码:
mHelpButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater inflater = (LayoutInflater) getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = inflater.inflate(R.layout.help_pop, null);
int width = WindowManager.LayoutParams.MATCH_PARENT;
int height = WindowManager.LayoutParams.WRAP_CONTENT;
final PopupWindow popupWindow = new PopupWindow(popupView, 1, 1, true);
popupWindow.setWindowLayoutMode(width,height);
popupWindow.setOutsideTouchable(true);
popupWindow.setBackgroundDrawable(new BitmapDrawable(getResources(), ""));
TextView helpText = (TextView) popupView.findViewById(R.id.help_text);
WebView webView = (WebView)popupView.findViewById(R.id.app_question_help_web_view);
if (!mQuestion.casiHelpText.contains("http://") && !mQuestion.casiHelpText.contains("<")) {
helpText.setText(mQuestion.casiHelpText);
popupWindow.showAsDropDown(mHelpButton);
} else if (mQuestion.casiHelpText.contains("http://") && !mQuestion.casiHelpText.contains("<")) {
if …Run Code Online (Sandbox Code Playgroud)