나는 지금 webview에 있는데, 나는 웹뷰에서 팝업 창을 보여 주려고 고심하고있다. 내가 만졌을 때마다 내가 터치 한 똑같은 위치에서 webview를 터치 할 때마다 팝업 창을 표시해야합니다. ontouchlistener를 시도했지만 여전히 팝업보기를 사용할 수 없습니다. 너희들이 내가이 문제를 해결하도록 도울 수 있겠 니? 미리 감사드립니다. 아래는 제 코드입니다.android의 webview에서 screentouch의 팝업 창을 표시하는 방법?
webView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
touch();
break;
case MotionEvent.ACTION_POINTER_DOWN:
touch();
break;
case MotionEvent.ACTION_MOVE:
touch();
break;
case MotionEvent.ACTION_UP:
touch();
break;
case MotionEvent.ACTION_POINTER_UP:
touch();
break;
}
return true;
}
});
public void touch() {
View popUpView = getLayoutInflater().inflate(R.layout.popup, null);
mpopup = new PopupWindow(popUpView, LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT, true);
mpopup.setAnimationStyle(android.R.style.Animation_Dialog);
mpopup.showAtLocation(popUpView, Gravity.NO_GRAVITY, 0, 0);
Button option = (Button) popUpView.findViewById(R.id.sign);
option.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mpopup.dismiss();
Intent intent = new Intent(View.this,
Capture.class);
startActivity(intent);
finish();
}
});
Button btnOk = (Button) popUpView.findViewById(R.id.date);
btnOk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mpopup.dismiss();
}
});
웹 뷰를 터치하면 앱이 다운됩니다.
popup.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:background="@android:color/transparent"
android:layout_height="wrap_content">
<Button
android:id="@+id/sign"
android:layout_width="160dp"
android:layout_height="60dp"
android:layout_toLeftOf="@+id/camera"
android:text="button" >
</Button>
<Button
android:id="@+id/date"
android:layout_width="160dp"
android:layout_height="60dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="button" />
</RelativeLayout>
당신이 당신의 로그 캣 메시지를 게시 할 수 : 다음
는 웹보기에 OnClickListener를 설정? – SLee
글쎄, 난 그냥 충돌이 어떤 예외가 없었어요. – Vicky
나는 logcat을 사용하여 내 질문을 업데이트 할 예정입니다. – Vicky